UNPKG

contaigents

Version:

Modular AI Content Ecosystem with Audio Generation

48 lines (47 loc) • 2.68 kB
#!/usr/bin/env node import { ChatService } from '../services/chatService.js'; import { PromptTemplates } from '../services/prompts/PromptTemplates.js'; async function testImprovedPlanner() { console.log('🧠 Testing Improved Planner with Enhanced Prompts...\n'); try { // Initialize chat service const chatService = new ChatService(process.cwd()); // Test 1: Default planning behavior console.log('šŸ“‹ Test 1: Default Planning Behavior'); const session1 = chatService.createSession(); console.log(`Created session with enhanced default prompt\n`); const response1 = await chatService.sendMessage(session1.id, "I need to update my project documentation. Can you help me create a comprehensive README file?"); console.log('šŸ¤– Response:', response1.content.substring(0, 200) + '...\n'); // Test 2: File operations context console.log('šŸ“ Test 2: File Operations Context'); const session2 = chatService.createSession({ systemPrompt: PromptTemplates.getContextualPrompt('file-operations') }); const response2 = await chatService.sendMessage(session2.id, "Analyze the current project structure and suggest improvements"); console.log('šŸ¤– Response:', response2.content.substring(0, 200) + '...\n'); // Test 3: Content creation context console.log('āœļø Test 3: Content Creation Context'); const session3 = chatService.createSession({ systemPrompt: PromptTemplates.getContextualPrompt('content-creation') }); const response3 = await chatService.sendMessage(session3.id, "Help me write a blog post about AI-powered content creation tools"); console.log('šŸ¤– Response:', response3.content.substring(0, 200) + '...\n'); // Test 4: Error handling console.log('āš ļø Test 4: Error Handling'); const errorPrompt = PromptTemplates.getErrorHandlingPrompt("API rate limit exceeded"); console.log('šŸ¤– Error Handling Response:', errorPrompt.substring(0, 200) + '...\n'); console.log('āœ… All planner tests completed successfully!'); console.log('\nšŸŽÆ Key Improvements Demonstrated:'); console.log('- āœ… Centralized prompt templates'); console.log('- āœ… Context-aware system prompts'); console.log('- āœ… Enhanced planning examples'); console.log('- āœ… Better error handling'); console.log('- āœ… Structured follow-up responses'); } catch (error) { console.error('āŒ Error testing improved planner:', error); process.exit(1); } } // Run the test testImprovedPlanner();