feature: Optional OCR-Assisted Draft Pre-Fill

This commit is contained in:
voltsrage
2026-06-28 01:28:54 +08:00
parent 5039dbb979
commit c160c5f912
42 changed files with 3592 additions and 33 deletions
@@ -0,0 +1,17 @@
import { type ComputedRef } from 'vue'
import type { OcrConfidenceMap } from '../types'
export function useOcrFieldConfidence(
ocrConfidence: ComputedRef<OcrConfidenceMap | null | undefined>,
) {
function fieldConfidenceClass(fieldPath: string): string {
if (!ocrConfidence.value) return ''
const confidence = ocrConfidence.value.fieldConfidences[fieldPath]
if (confidence === undefined) return ''
if (confidence >= 0.85) return 'ocr-high'
if (confidence >= 0.7) return 'ocr-medium'
return 'ocr-low'
}
return { fieldConfidenceClass }
}