Port the original #27 detected-language pipeline onto the verified PR #39 prerequisite while preserving the current-main conversation instrument and host continuity changes. Keep voice selection server-side with no user selector or client voice field. Reuse 207c16ab only for its stricter exact-code trust boundary, omitting malformed or absent language so Piper defaults to Amy.
42 lines
919 B
Python
42 lines
919 B
Python
"""Pinned Atlas TTS route anchors used by image-patch tests."""
|
|
|
|
import json
|
|
import os
|
|
from urllib.request import ProxyHandler, Request, build_opener
|
|
|
|
|
|
class _NoRedirectTtsHandler:
|
|
"""Placeholder for the upstream no-redirect opener handler."""
|
|
|
|
|
|
class _Logger:
|
|
def exception(self, message):
|
|
return None
|
|
|
|
|
|
logger = _Logger()
|
|
|
|
|
|
class _Upstream:
|
|
def read(self):
|
|
return b"RIFFsynthetic"
|
|
|
|
def __enter__(self):
|
|
return self
|
|
|
|
def __exit__(self, *exc_info):
|
|
return False
|
|
|
|
|
|
def _buffer_tts_audio_response(response):
|
|
return response.read()
|
|
|
|
|
|
def _tts_open(req, *, timeout=30, opener_factory=None):
|
|
return _Upstream()
|
|
|
|
|
|
def _handle_tts(handler, data, text, rate_str, engine):
|
|
# ── ElevenLabs TTS ──────────────────────────────────────────────────
|
|
return None
|