|
|
@@ -361,8 +361,9 @@ export const appRouter = router({
|
|
|
erpContext = await lookupOrder(soId, userCtx);
|
|
|
|
|
|
// 2. "my orders" / "recent orders" — needs customer CID on conversation
|
|
|
- } else if (/\b(my orders?|recent orders?|order history|order status)\b/.test(msgLower)) {
|
|
|
+ } else if (/\b(my orders?|recent orders?|order history|order status|help with my order|check.*order|view.*order|see.*order|show.*order)\b/.test(msgLower)) {
|
|
|
const cid = ctx.user?.erpContactCid ?? (conversation as any).customerId as string | undefined;
|
|
|
+ console.log(`[ERP] intent=my_orders user=${ctx.user?.id ?? "anon"} role=${userCtx.role} cid=${cid ?? "none"}`);
|
|
|
if (cid) {
|
|
|
erpContext = await lookupOrdersByCustomer(cid, 5, userCtx);
|
|
|
} else {
|