Files

21 lines
1.1 KiB
JavaScript

/* Verify name-based conversation lookup. */
import { connectMongo } from '../src/data/mongo.js';
import { getConversation, searchConversations } from '../src/tools/crm/conversations.tools.js';
await connectMongo();
const cfg = { configurable: { user: { id: 'x', name: 'Test', role: 'admin' }, runtime: { toolCallCount: 0 } } };
const show = (label, r) => {
const j = typeof r === 'string' ? JSON.parse(r) : r;
console.log(`\n── ${label}`);
console.log(JSON.stringify(j, null, 1).slice(0, 900));
};
show('get_conversation by NAME "md salim"', await getConversation.invoke({ person: 'md salim' }, cfg));
show('get_conversation by NAME "Md Salim"', await getConversation.invoke({ person: 'Md Salim' }, cfg));
show('get_conversation by PHONE', await getConversation.invoke({ person: '919361281813' }, cfg));
show('get_conversation, nonexistent', await getConversation.invoke({ person: 'Zzzz Nobody' }, cfg));
show('search_conversations name filter', await searchConversations.invoke({ name: 'salim', limit: 3 }, cfg));
show('search_conversations (names joined in)', await searchConversations.invoke({ limit: 3 }, cfg));
process.exit(0);