feature: Optional OCR-Assisted Draft Pre-Fill
This commit is contained in:
@@ -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 }
|
||||
}
|
||||
Reference in New Issue
Block a user