fix(desktop): add precise local OCR reading
This commit is contained in:
parent
59cdddbecb
commit
25fd3ac004
30 changed files with 626 additions and 15 deletions
|
|
@ -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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue