feat(backend): deliver Phase 3 document and voice integration
Add authenticated upload, review, retry and knowledge-selection HTTP flows with bounded JSON processing and frozen OCR policy. Preserve Gemini/OpenAI provider selection and fenced lifecycle semantics; retain FAQ preambles and uncertain vision candidates, and expose opt-in uncalibrated voice transport diagnostics. Include frontend integration examples, aligned contracts and deterministic regressions. Validation: 1767 provider-free tests passed; all 404 PostgreSQL scenarios have passing evidence across the documented runs.
This commit is contained in:
@@ -11,6 +11,14 @@ class LegacyProcessingProfile(ValueError):
|
||||
pass
|
||||
|
||||
|
||||
def ocr_review_required(profile: Mapping) -> bool:
|
||||
"""Fail closed for legacy snapshots; deployment defaults never reinterpret jobs."""
|
||||
value = profile.get("extraction", {}).get("ocr_review_required", True)
|
||||
if type(value) is not bool:
|
||||
raise ValueError("Invalid frozen OCR review policy")
|
||||
return value
|
||||
|
||||
|
||||
def processing_profile_kind(profile: Mapping) -> str:
|
||||
if "profile_schema" not in profile and profile.get("extractor") == "pypdf-markdown-v1":
|
||||
return "legacy-v1"
|
||||
@@ -20,6 +28,7 @@ def processing_profile_kind(profile: Mapping) -> str:
|
||||
|
||||
|
||||
def extraction_profile_digest(profile: Mapping) -> str:
|
||||
ocr_review_required(profile)
|
||||
if processing_profile_kind(profile) == "legacy-v1":
|
||||
raise LegacyProcessingProfile("Legacy extractor requires explicit legacy dispatch; OCR reinterpretation is forbidden")
|
||||
# Faithful extraction is reusable across chunk/embedding/normalization changes.
|
||||
|
||||
Reference in New Issue
Block a user