Ver Fonte

fix: expand my-orders regex and add debug log for ERP intent detection

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tony T há 6 dias atrás
pai
commit
8bc5474756
1 ficheiros alterados com 2 adições e 1 exclusões
  1. 2 1
      server/routers.ts

+ 2 - 1
server/routers.ts

@@ -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 {