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:
@@ -0,0 +1,17 @@
|
||||
"""Selected voice transport construction shared by the API and operator smoke."""
|
||||
import asyncio
|
||||
from app.infrastructure.gemini_live import GeminiLiveAdapter, connect_gemini
|
||||
from app.infrastructure.realtime import RealtimeAdapter, connect as connect_openai
|
||||
|
||||
|
||||
async def create_adapter(config, limits):
|
||||
config.require_voice()
|
||||
connect = connect_gemini if config.provider == 'gemini' else connect_openai
|
||||
transport = await asyncio.wait_for(connect(config.selected_key.get_secret_value(),
|
||||
config.selected_model, config.selected_proxy, limits), limits.connect_timeout_seconds)
|
||||
try:
|
||||
adapter = GeminiLiveAdapter if config.provider == 'gemini' else RealtimeAdapter
|
||||
return adapter(transport, model=config.selected_model, voice=config.selected_voice, settings=limits)
|
||||
except BaseException:
|
||||
await asyncio.wait_for(transport.close(), limits.send_timeout_seconds)
|
||||
raise
|
||||
Reference in New Issue
Block a user