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:
11linear11
2026-10-09 17:43:52 -04:00
parent 9be47191d6
commit a73a496c54
67 changed files with 5988 additions and 234 deletions
+15 -2
View File
@@ -78,12 +78,18 @@ INGEST_MAX_EXTRACTED_BLOCKS=10000
INGEST_EMBEDDING_SEND_DIMENSIONS=false
INGEST_EMBEDDING_MAX_RESPONSE_BYTES=16777216
# Temporary sole voice provider; independent of extraction and embedding credentials.
PROVIDER=gemini
# Backend voice selection; Gemini is the temporary default. No automatic fallback.
# Legacy PROVIDER is accepted; do not set it differently from VOICE_PROVIDER.
VOICE_PROVIDER=gemini
GEMINI_API_KEY=
GEMINI_MODEL=gemini-2.0-flash-exp
GEMINI_VOICE=Aoede
# GEMINI_PROXY=https://trusted-proxy.example:443
# Required only when VOICE_PROVIDER=openai. Independent of embedding/LLM OPENAI_API_KEY.
OPENAI_REALTIME_API_KEY=
OPENAI_REALTIME_MODEL=gpt-realtime-mini
OPENAI_REALTIME_VOICE=shimmer
# OPENAI_REALTIME_PROXY=https://trusted-proxy.example:443
TRUSTED_ORIGINS=["http://localhost:8000","http://127.0.0.1:8000"]
TRUSTED_HOSTS=["localhost:8000","127.0.0.1:8000"]
# Explicit local development only. Production requires HTTPS and true.
@@ -92,3 +98,10 @@ AUTH_SESSION_SECONDS=28800
LIVE_SESSION_SECONDS=600
# Path to a measured, profile-compatible calibrated report; never a status placeholder.
# SEARCH_CALIBRATION_REPORT=/absolute/path/measured-report.json
# Explicit connectivity testing only; no uncalibrated document evidence is admitted.
# Sessions expose calibration_status=uncalibrated. Production default remains false.
VOICE_TRANSPORT_TESTING=false
# OCR supervisor gate for NEW jobs only; false admits only automatically validated OCR.
# Existing/legacy jobs keep their frozen policy. Factual/non-OCR review remains required.
INGEST_OCR_REVIEW_REQUIRED=true