feat(voice): implement local S2S responsiveness candidate and direct TTS routing
Add local S2S responsiveness candidate pinning ASR options and sentence-at-a-time generation. Route speech synthesis directly to OpenAI API for fluent Persian phonetics with gpt-4o-mini-tts-2025-12-15. Add responsiveness, budget carry, and browser watch unit tests along with acceptance benchmarks and evaluation evidence.
This commit is contained in:
@@ -12,15 +12,18 @@ module=importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
|
||||
|
||||
def start_components(key, timeout):
|
||||
transport=module.BrowserBudget(Path('/evidence'))
|
||||
class OwnedGateway(ComponentServer):
|
||||
async def _run(self):
|
||||
try:
|
||||
await super()._run()
|
||||
finally:
|
||||
await transport.close_owned()
|
||||
gateway=OwnedGateway(key,port=8766,transport=transport,timeout=timeout)
|
||||
def start_components(key, timeout, **options):
|
||||
if os.environ.get('LOCAL_S2S_TTS_MODEL') == 'google/gemini-3.8-flash-lite-tts':
|
||||
transport=module.BrowserBudget(Path('/evidence'))
|
||||
class OwnedGateway(ComponentServer):
|
||||
async def _run(self):
|
||||
try:
|
||||
await super()._run()
|
||||
finally:
|
||||
await transport.close_owned()
|
||||
gateway=OwnedGateway(key,port=8766,transport=transport,timeout=timeout,**options)
|
||||
else:
|
||||
gateway=ComponentServer(key,port=8766,timeout=timeout,**options)
|
||||
thread=Thread(target=gateway.serve_forever,daemon=True)
|
||||
thread.start()
|
||||
if not gateway.ready.wait(5):
|
||||
@@ -31,4 +34,6 @@ lifecycle.start_components=start_components
|
||||
# The key is mounted only into this engine, never Compose environment/API/browser.
|
||||
import os
|
||||
os.environ['OPENROUTER_API_KEY']=Path('/secret/openrouter-test.key').read_text().strip()
|
||||
if Path('/secret/openai-test.key').exists():
|
||||
os.environ['OPENAI_API_KEY']=Path('/secret/openai-test.key').read_text().strip()
|
||||
raise SystemExit(main())
|
||||
|
||||
Reference in New Issue
Block a user