UNPKG

contaigents

Version:

Modular AI Content Ecosystem with Audio Generation

65 lines (52 loc) 2.65 kB
#!/usr/bin/env node // Simple test script to demonstrate the memory system import { ChatService } from './dist/services/chatService.js'; async function testMemorySystem() { console.log('🧠 Testing Memory System...\n'); // Initialize chat service const chatService = new ChatService(process.cwd()); // Create a chat session const session = chatService.createSession({ systemPrompt: `You are a helpful AI assistant with memory capabilities. Use the memory tool to maintain context across our conversation. When I give you information to remember, use the memory tool to store it. When I ask you to recall something, check your memory first.` }); console.log(`💬 Created chat session: ${session.id}\n`); try { // Test 1: Store some information in memory console.log('📝 Test 1: Storing information in memory...'); const response1 = await chatService.sendMessage( session.id, "Please remember that I'm working on a screenplay agent project. I successfully modified the PromptTemplates.ts file to create a cinematic screenplay creation assistant. The test completed successfully and the agent now creates story outlines, character profiles, and scene files with visual sketches." ); console.log('Response:', response1.content.substring(0, 200) + '...\n'); // Test 2: Ask the agent to recall information console.log('🔍 Test 2: Asking agent to recall information...'); const response2 = await chatService.sendMessage( session.id, "What do you remember about my recent work? Please check your memory." ); console.log('Response:', response2.content.substring(0, 300) + '...\n'); // Test 3: Add more information console.log('📝 Test 3: Adding more information...'); const response3 = await chatService.sendMessage( session.id, "Also remember that we implemented a memory system with MemoryTool that can read, append, update, clear, and summarize memory entries. The memory is stored in .chat_memory.txt file." ); console.log('Response:', response3.content.substring(0, 200) + '...\n'); // Test 4: Check memory content directly console.log('📋 Test 4: Checking memory file content...'); const fs = await import('fs/promises'); try { const memoryContent = await fs.readFile('.chat_memory.txt', 'utf-8'); console.log('Memory file content:'); console.log(memoryContent); } catch (error) { console.log('Memory file not found or empty'); } } catch (error) { console.error('❌ Test failed:', error.message); } } // Run the test testMemorySystem().catch(console.error);