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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user