Files
HealthLog/src/app/api/labs/ocr/capability/route.ts
T
Marc-André Bombeck e023571a08 chore(labs): tidy OCR capability enum, Fitbit key delimiter, Coach docblock
Drop the unreachable text-only-model reason from the OCR capability
enum and its DTO type. Replace the literal NUL delimiter in the Fitbit
dedup map keys with a named constant so text tooling stops treating the
file as binary (behaviour unchanged). Correct the Coach tool-executor
docblock, which overstated cross-tool snapshot-cache sharing.
2026-06-26 09:27:05 +02:00

33 lines
1.0 KiB
TypeScript

/**
* v1.18.9 — GET /api/labs/ocr/capability
*
* Cheap probe (no provider call) the Labs UI uses to decide whether to show
* the "Scan a report" affordance. Returns `{ available, reason, pdfSupported }`
* for the calling user's configured AI provider. The surface stays dark for
* users with no provider configured and no local-OCR opt-in.
*/
import { apiHandler, requireAuth } from "@/lib/api-handler";
import { apiSuccess } from "@/lib/api-response";
import { resolveOcrCapability } from "@/lib/labs/ocr-capability";
import { annotate } from "@/lib/logging/context";
export const dynamic = "force-dynamic";
export const GET = apiHandler(async () => {
const { user } = await requireAuth();
const capability = await resolveOcrCapability(user.id);
annotate({
action: { name: "labs.ocr.capability" },
meta: {
available: capability.available,
mode: capability.mode,
reason: capability.reason,
pdfSupported: capability.pdfSupported,
},
});
return apiSuccess(capability);
});