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
@@ -1,5 +1,6 @@
"""Actual proxied auth/API/native setup/normal close; sends no microphone audio."""
import asyncio
import argparse
import json
from pathlib import Path
from uuid import uuid4
@@ -7,7 +8,12 @@ import httpx
from websockets.asyncio.client import connect
root=Path('.local-s2s-build')
account=json.loads((root/'browser-login.json').read_text())
parser=argparse.ArgumentParser(description=__doc__)
parser.add_argument('--account',type=Path,default=root/'browser-login.json')
parser.add_argument('--ledger',type=Path,default=root/'phase4-browser-paid/browser-paid-ledger.json')
parser.add_argument('--output',type=Path,default=root/'phase4-browser-connection-result.json')
args=parser.parse_args()
account=json.loads(args.account.read_text())
origin='http://127.0.0.2:4201'
async def main():
@@ -26,7 +32,7 @@ async def main():
report['providers']=metadata.json()
assert next(p for p in report['providers']['providers'] if p['id']=='local_s2s')['can_start']
assert not next(p for p in report['providers']['providers'] if p['id']=='openai')['can_start']
ledger=root/'phase4-browser-paid'/'browser-paid-ledger.json'
ledger=args.ledger
before=len(json.loads(ledger.read_text())['attempts'])
try:
async with connect('ws://127.0.0.2:4201'+session['stream_path'],origin=origin,
@@ -44,7 +50,7 @@ async def main():
client.post('/api/v1/auth/logout')
report['component_attempts_before']=before
report['component_attempts_after']=len(json.loads(ledger.read_text())['attempts'])
(root/'phase4-browser-connection-result.json').write_text(json.dumps(report,indent=2)+'\n')
args.output.write_text(json.dumps(report,indent=2)+'\n')
assert report.get('session_ready')
assert before==report['component_attempts_after'],'Unexpected inference during connection-only check'
print(json.dumps(report))