Replaces every em-dash and en-dash with regular ASCII hyphens across comments, JSX strings, and dev-facing logs. Mostly cosmetic but stops the inconsistent mix that crept in over the last few months (some files used em-dashes in comments, others didn't, some used both). Bundles two small dashboard-layout tweaks that touch a couple of already-modified files: - (dashboard)/layout.tsx main padding goes from p-6 to pt-3 px-6 pb-6 so page content sits closer to the topbar. - Sidebar now receives the ports list it needs for the footer port switcher. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
/**
|
|
* Claude Vision-driven OCR for expense receipts. PR1 stub: types and the
|
|
* service contract. The actual API call wires up in PR9 with prompt
|
|
* caching on the system text and Haiku 4.5 by default.
|
|
*/
|
|
|
|
export interface OcrLineItem {
|
|
description: string;
|
|
quantity?: number;
|
|
unitPrice?: number;
|
|
amount: number;
|
|
}
|
|
|
|
export interface OcrResult {
|
|
vendor: string | null;
|
|
amount: number | null;
|
|
currency: string | null;
|
|
/** ISO date YYYY-MM-DD. */
|
|
date: string | null;
|
|
lineItems: OcrLineItem[];
|
|
/** 0..1; below 0.6 surfaces "verify mode" UI. */
|
|
confidence: number;
|
|
}
|
|
|
|
export interface OcrContext {
|
|
fileId: string;
|
|
fileUrl: string;
|
|
/** Optional MIME hint; the service still detects from bytes. */
|
|
mimeType?: string;
|
|
}
|
|
|
|
/** Cost ceiling per call (Haiku 4.5 + cached system prompt). PR9 enforces. */
|
|
export const OCR_MAX_TOKENS = 1024;
|
|
export const OCR_LOW_CONFIDENCE_THRESHOLD = 0.6;
|
|
|
|
/** Stub - returns "pending" shape so callers can wire UI in PR1 without
|
|
* Anthropic credentials. */
|
|
export async function ocrReceipt(_ctx: OcrContext): Promise<OcrResult> {
|
|
return {
|
|
vendor: null,
|
|
amount: null,
|
|
currency: null,
|
|
date: null,
|
|
lineItems: [],
|
|
confidence: 0,
|
|
};
|
|
}
|