feat(copilot): enhance OCR handling with inline tags and document serializer

- Replace HTML comment OCR metadata with inline `<OCR:...>` tags
- Implement serializer-based markdown conversion for prefix/suffix content
- Add extractTextFromOCR utility function for text extraction
- Enable Table, Diagram, and ListCheck features in MilkdownEditor
- Add periodic debug logging for document state analysis
This commit is contained in:
2026-02-14 23:53:26 +08:00
parent 794fbf8493
commit 03bb21d5c6
5 changed files with 3496 additions and 225 deletions
+8
View File
@@ -43,3 +43,11 @@ export function checkSizeLimit(docTextSize, imageFilenames) {
}
export const OCR_SIZE_LIMIT = SIZE_LIMIT
export function extractTextFromOCR(ocrText, maxLen = 100) {
if (!ocrText) return ''
const match = ocrText.match(/TEXT:\s*([\s\S]*?)(?:KEY_DETAILS|LANGUAGE|SUMMARY|$)/i)
let text = match ? match[1].trim() : ocrText.trim()
if (text.toLowerCase() === '(none)') return ''
return text.length > maxLen ? text.substring(0, maxLen) + '...' : text
}