WeLe Agentic AI: LangGraph multi-agent CRM assistant with voice

This commit is contained in:
2026-08-28 02:16:03 +05:30
commit 105e58e02a
69 changed files with 11501 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
/* Does "salim" exist anywhere, and why did the search miss it? */
import { connectMongo } from '../src/data/mongo.js';
import { Lead, Conversation } from '../src/data/models/index.js';
await connectMongo();
const rx = /salim/i;
const leads = await Lead.find({ $or: [{ name: rx }, { wa_name: rx }] })
.select('name wa_name phone_number current_stage').limit(10).lean();
console.log(`LEADS matching /salim/i: ${leads.length}`);
for (const l of leads) console.log(` name="${l.name}" wa_name="${l.wa_name}" phone=${l.phone_number} stage=${l.current_stage}`);
const convs = await Conversation.find({ participant_name: rx })
.select('participant_name phone_number channel messages').limit(10).lean();
console.log(`\nCONVERSATIONS matching participant_name /salim/i: ${convs.length}`);
for (const c of convs) console.log(` "${c.participant_name}" ${c.phone_number} ${c.channel} msgs=${c.messages?.length ?? 0}`);
// If a lead matched, is there a conversation on that phone?
for (const l of leads.slice(0, 3)) {
const byPhone = await Conversation.find({ phone_number: l.phone_number })
.select('participant_name phone_number channel messages').lean();
console.log(`\nconversations for lead phone ${l.phone_number}: ${byPhone.length}`);
for (const c of byPhone) {
console.log(` participant_name="${c.participant_name}" channel=${c.channel} msgs=${c.messages?.length ?? 0}`);
}
}
// How are participant_name values actually populated?
const total = await Conversation.countDocuments();
const named = await Conversation.countDocuments({ participant_name: { $nin: ['', null] } });
console.log(`\nconversations total=${total} with a participant_name=${named} (${Math.round(named / total * 100)}%)`);
const sample = await Conversation.find({}).select('participant_name phone_number').limit(5).lean();
console.log('sample participant_name values:', sample.map((s) => JSON.stringify(s.participant_name)).join(', '));
process.exit(0);