fix(ocr): address code review feedback on multi-language OCR

- Fix _get_pipeline_ocr_language: remove redundant `or None` in step_config.get()
- Add Session type hint to _get_pipeline_ocr_language db parameter via TYPE_CHECKING
- Update process_with_ocr to use modern str | None syntax instead of Optional[str]
- Fix test_get_pipeline_ocr_language_explicit_pipeline_takes_priority: properly add
  sys_step to db_session so the system pipeline step is persisted in the test DB

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-08 21:49:49 +00:00
parent a2a4c6fc9a
commit 0b291995b9
3 changed files with 14 additions and 7 deletions
+3 -4
View File
@@ -17,7 +17,6 @@ task with a multi-engine OCR pipeline that:
import logging
import os
from typing import Optional
from app.celery_app import celery
from app.config import settings
@@ -36,9 +35,9 @@ logger = logging.getLogger(__name__)
def process_with_ocr(
self,
filename: str,
file_id: Optional[int] = None,
original_text: Optional[str] = None,
language: Optional[str] = None,
file_id: int | None = None,
original_text: str | None = None,
language: str | None = None,
):
"""Run the configured OCR providers on *filename* and continue the pipeline.