3f255ea201
Extract shared vision/document analysis logic into lib/ai (vision-client, document-analyzer, image preprocessing, validation helpers), simplifying invoice-analyzer, receipt-analyzer, and document classifier. Add migration 046 for journal entry reversal/correction link columns (reversed_by_id, reverses_id, correction_of_id) required by storno service. Update extension components and shared UI. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
28 lines
860 B
TypeScript
28 lines
860 B
TypeScript
/**
|
|
* Document Classifier — thin wrapper around lib/ai/document-analyzer.
|
|
*
|
|
* SERVER-ONLY: delegates to the shared vision client.
|
|
*
|
|
* Classifies documents as supplier invoices, receipts, government letters,
|
|
* or unknown. Also detects EU reverse charge for supplier invoices.
|
|
*
|
|
* This module preserves the original public API — existing callers see no change.
|
|
*/
|
|
|
|
import 'server-only'
|
|
import { classifyDocument as classifyCore } from '@/lib/ai/document-analyzer'
|
|
|
|
// Re-export the type so existing imports work
|
|
export type { DocumentClassification } from '@/lib/ai/document-analyzer'
|
|
|
|
/**
|
|
* Classify a document using Claude Haiku Vision.
|
|
* Determines if it's a supplier invoice, receipt, government letter, or unknown.
|
|
*/
|
|
export async function classifyDocument(
|
|
base64: string,
|
|
mimeType: string
|
|
) {
|
|
return classifyCore(base64, mimeType)
|
|
}
|