feat(ocr): add AI-based embedded text quality check with automatic OCR fallback

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-24 18:41:27 +00:00
parent ebdb332117
commit b03bfb5e02
6 changed files with 1141 additions and 0 deletions
+13
View File
@@ -276,6 +276,19 @@ class Settings(BaseSettings):
),
)
# Text quality check - AI-based assessment of embedded PDF text
enable_text_quality_check: bool = Field(
default=True,
description=(
"Enable AI-based quality check for embedded PDF text. "
"When enabled, text extracted from non-digital PDFs is evaluated by the AI model. "
"If the text is poor quality (OCR artefacts, typos, incoherence), the file is "
"re-processed with OCR instead of using the embedded text. "
"Digitally-created PDFs (Word, LibreOffice, LaTeX, etc.) are always trusted and "
"bypass the check. Default: True (enabled)."
),
)
# Processing step timeout - prevents files from getting stuck in "in_progress" state
step_timeout: int = Field(
default=600,