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:
amirhosein mazaheri
2026-10-17 13:02:41 +03:30
parent a94b8cd3ea
commit 628aec8def
40 changed files with 1568 additions and 70 deletions
+10 -2
View File
@@ -1,4 +1,4 @@
"""Development engine launcher; local asset preflight precedes every paid probe."""
"""Development engine launcher; local asset preflight precedes every paid probe."""
import argparse
import json
import logging
@@ -33,6 +33,13 @@ def build_runtime(config, stop):
pipeline.Queue = PipelineQueue
# Base setup invokes warmup from inside construction; install before it runs.
install_client_policy(base_llm, config)
import speech_to_speech.TTS.openai_compatible_handler as native_tts
from services.local_s2s.request_policy import install_tts_speed
install_tts_speed(native_tts, config.local_s2s_tts_speed)
if config.local_s2s_responsive:
import speech_to_speech.STT.openai_compatible_handler as native_stt
from services.local_s2s.responsiveness import install_stt_policy
install_stt_policy(native_stt)
# The pinned output processor also detects language for fixed session configs.
# Its first lazy Lingua preload can hold the GIL beyond the media send deadline.
# Prime the same cache before exposing the listener, within the startup budget.
@@ -87,7 +94,8 @@ def main():
key = os.environ.get('OPENROUTER_API_KEY', '')
if not key:
parser.error('OPENROUTER_API_KEY is required in the engine only.')
return run_owned(lambda stop: build_runtime(config, stop), key, config.local_s2s_request_timeout_seconds)
return run_owned(lambda stop: build_runtime(config, stop), key, config.local_s2s_request_timeout_seconds,
component_options={'responsive': True} if config.local_s2s_responsive else None)
if __name__ == '__main__':