From 9ddb811afd6d3f21fb20b13f4ad17bc1e6e347c3 Mon Sep 17 00:00:00 2001 From: Dave Date: Mon, 19 Oct 2026 12:18:13 +0200 Subject: [PATCH] feat(collection-confirm): AI checks on/off switch in the page header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The n8n tick was calling in every 5 minutes but WFDASH answered "disabled" because Collection checks was off in Settings → AI, and nothing on Collection Confirm said so. - New "AI checks" switch next to Refresh, the same setting as Settings → AI → Collection checks. Purple and "On" when running, with the last run in the tooltip; a gear links to /settings/ai. - GET/PUT /api/v1/collection-confirm/ai/enabled (browser session). Only reads/writes collection_ai_enabled and the last run — no key, model or prompt goes through it. Co-Authored-By: Claude Opus 5.5 --- src/app/(app)/collection-confirm/page.tsx | 4 +- .../ai/enabled/route.test.ts | 77 ++++++++++++ .../v1/collection-confirm/ai/enabled/route.ts | 60 +++++++++ .../ai-checks-toggle.test.tsx | 59 +++++++++ .../collection-confirm/ai-checks-toggle.tsx | 119 ++++++++++++++++++ 5 files changed, 318 insertions(+), 1 deletion(-) create mode 100644 src/app/api/v1/collection-confirm/ai/enabled/route.test.ts create mode 100644 src/app/api/v1/collection-confirm/ai/enabled/route.ts create mode 100644 src/components/collection-confirm/ai-checks-toggle.test.tsx create mode 100644 src/components/collection-confirm/ai-checks-toggle.tsx diff --git a/src/app/(app)/collection-confirm/page.tsx b/src/app/(app)/collection-confirm/page.tsx index 7654511..bb9371b 100644 --- a/src/app/(app)/collection-confirm/page.tsx +++ b/src/app/(app)/collection-confirm/page.tsx @@ -5,6 +5,7 @@ import { Bot, Loader2, Search, Truck, UserRound } from "lucide-react"; import { toast } from "sonner"; import { Button } from "@/components/ui/button"; +import { AiChecksToggle } from "@/components/collection-confirm/ai-checks-toggle"; import { ConfirmInvoiceDialog } from "@/components/collection-confirm/confirm-invoice-dialog"; import { ConfirmStockDialog } from "@/components/collection-confirm/confirm-stock-dialog"; import { InvoiceViewer } from "@/components/collection-confirm/invoice-viewer"; @@ -802,7 +803,7 @@ export default function CollectionConfirmPage() { Review collected order items, edit costs, and confirm for invoicing.

-
+
{displayName || "—"} +