fix(desktop): add precise local OCR reading

This commit is contained in:
Yun Chan 2026-11-21 10:15:49 +09:00
parent 59cdddbecb
commit 25fd3ac004
30 changed files with 626 additions and 15 deletions

View file

@ -0,0 +1,11 @@
export function unwrapOcrCodeFence(raw: string, source: string): string {
const lines = raw.split('\n')
if (lines.length < 3 || source.includes('```')) return raw
if (!/^```[A-Za-z0-9_+.-]*$/u.test(lines[0].trim()) || lines[lines.length - 1].trim() !== '```') return raw
const body = lines.slice(1, -1).join('\n')
return body.includes('```') ? raw : body
}
export function isPrecisionOutputWithinBounds(raw: string, source: string): boolean {
return Array.from(raw).length <= Math.max(4000, Array.from(source).length * 8)
}