contaigents
Version:
Modular AI Content Ecosystem with Audio Generation
48 lines (47 loc) ⢠2.69 kB
JavaScript
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 = await 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 = await 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 = await 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();