fix(ocr): sync workflow steps with process_with_ocr replacing legacy azure step

- Update _compute_processing_flow to recognize process_with_ocr as the OCR
  stage and remap legacy process_with_azure_document_intelligence log entries
  for backward compatibility
- Normalize legacy OCR step name in _compute_step_summary log fallback
- Add process_with_ocr to REAL_MAIN_STEPS/REAL_STEPS in step_manager,
  file_status, and file_queries (keeping legacy name for old DB entries)
- Update retry logic in api/files.py to retry failed OCR via process_with_ocr
  (handles both step names as aliases)
- Fix process_document.py to log process_with_ocr as skipped (not azure step)
  for the local text extraction path

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-24 22:22:06 +00:00
parent f937fd4971
commit 37a3f7aae7
6 changed files with 34 additions and 22 deletions
+6
View File
@@ -201,10 +201,13 @@ def get_file_overall_status(db: Session, file_id: int) -> Dict:
# Define which steps are "real" status-determining steps
# Only high-level logical steps, not implementation sub-steps
# Both process_with_ocr (current) and process_with_azure_document_intelligence (legacy)
# are included to correctly count steps for files processed before the OCR abstraction.
REAL_MAIN_STEPS = {
"create_file_record",
"check_text",
"extract_text",
"process_with_ocr",
"process_with_azure_document_intelligence",
"extract_metadata_with_gpt",
"embed_metadata_into_pdf",
@@ -286,10 +289,13 @@ def get_step_summary(db: Session, file_id: int) -> Dict:
"""
# Define which steps are "real" status-determining steps
# Only high-level logical steps, not implementation sub-steps
# Both process_with_ocr (current) and process_with_azure_document_intelligence (legacy)
# are included to correctly count steps for files processed before the OCR abstraction.
REAL_MAIN_STEPS = {
"create_file_record",
"check_text",
"extract_text",
"process_with_ocr",
"process_with_azure_document_intelligence",
"extract_metadata_with_gpt",
"embed_metadata_into_pdf",