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
+18
View File
@@ -0,0 +1,18 @@
import { connectMongo } from '../src/data/mongo.js';
import { CapiEvent } from '../src/data/models/index.js';
await connectMongo();
const rows = await CapiEvent.aggregate([
{ $group: { _id: '$event_name', total: { $sum: 1 },
failed: { $sum: { $cond: [{ $eq: ['$status','failed'] }, 1, 0] } } } },
{ $project: { _id:0, event:'$_id', total:1, failed:1,
rate: { $round: [{ $multiply: [{ $divide: ['$failed','$total'] }, 100] }, 1] } } },
{ $sort: { rate: -1 } },
]);
console.log('event total failed fail%');
for (const r of rows) console.log(String(r.event).padEnd(22), String(r.total).padStart(5), String(r.failed).padStart(7), String(r.rate).padStart(6));
const errs = await CapiEvent.aggregate([
{ $match: { status:'failed', event_name:'Purchase' } },
{ $group: { _id:'$error', n:{ $sum:1 } } }, { $sort:{ n:-1 } },
]);
console.log('\nPurchase failure reasons:', JSON.stringify(errs));
process.exit(0);