WeLe Agentic AI: LangGraph multi-agent CRM assistant with voice
This commit is contained in:
@@ -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);
|
||||
Reference in New Issue
Block a user