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>
24 lines
678 B
TypeScript
24 lines
678 B
TypeScript
/**
|
|
* Invoice Analyzer — delegates to lib/ai/document-analyzer for extraction,
|
|
* then applies invoice-specific validation and enhancement.
|
|
*
|
|
* SERVER-ONLY: uses the shared vision client via document-analyzer.
|
|
*
|
|
* Preserved public API: analyzeInvoice().
|
|
*/
|
|
|
|
import 'server-only'
|
|
import type { InvoiceExtractionResult } from '../types'
|
|
import { extractInvoice } from '@/lib/ai/document-analyzer'
|
|
|
|
/**
|
|
* Analyze a supplier invoice using Claude Haiku Vision.
|
|
* Delegates extraction to the shared core.
|
|
*/
|
|
export async function analyzeInvoice(
|
|
fileBase64: string,
|
|
mimeType: string
|
|
): Promise<InvoiceExtractionResult> {
|
|
return extractInvoice(fileBase64, mimeType)
|
|
}
|