|
@@ -301,10 +301,12 @@ export const appRouter = router({
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// ── Workflow Flow Engine ──────────────────────────────────────────────
|
|
// ── Workflow Flow Engine ──────────────────────────────────────────────
|
|
|
- // Check if user message triggers a live Support Flow
|
|
|
|
|
|
|
+ // Check if user message triggers a live Support Flow.
|
|
|
|
|
+ // Skip for authenticated dealers with erpContactCid — ERP lookup will handle it.
|
|
|
|
|
+ const skipFlow = !!(ctx.user?.erpContactCid);
|
|
|
let flowResult: { content: string; shouldEscalate?: boolean; flowId: string } | null = null;
|
|
let flowResult: { content: string; shouldEscalate?: boolean; flowId: string } | null = null;
|
|
|
try {
|
|
try {
|
|
|
- const matchedFlowId = detectFlowIntent(input.content);
|
|
|
|
|
|
|
+ const matchedFlowId = skipFlow ? null : detectFlowIntent(input.content);
|
|
|
if (matchedFlowId) {
|
|
if (matchedFlowId) {
|
|
|
flowResult = await executeFlow(matchedFlowId, input.content);
|
|
flowResult = await executeFlow(matchedFlowId, input.content);
|
|
|
}
|
|
}
|