Skip to content

The agent that grows with you

chore: stack on #115840 to resolve gateway/streaming_tts_consumer.py conflict

teknium17845213b4d29
diff --cc gateway/streaming_tts_consumer.py
index 930365f70a9,af57a8d7c68..da64652924d
--- a/gateway/streaming_tts_consumer.py
+++ b/gateway/streaming_tts_consumer.py
@@@ -34,11 -38,10 +38,10 @@@ class StreamingTTSConsumer
self._adapter, self._chat_id, self._loop, self._metadata = adapter, chat_id, loop, metadata
# Resolved once; None => inactive, gateway falls back to whole-file TTS.
self._streamer = resolve_streaming_provider(tts_config)
- self._chunker = SentenceChunker()
+ self._chunker = SentenceChunker.from_config(tts_config)
- self._audio_format = audio_format or AudioFormat() if self._streamer is None else (
- AudioFormat(**{f: int(getattr(self._streamer, f, getattr(AudioFormat, f)))
- for f in ("sample_rate", "channels", "sample_width")})
- )
+ # Provisional: refreshed from the streamer when the handle opens on the first PCM chunk,
+ # since an OpenAI-compatible endpoint reports its real rate only in the response (#76466).
+ self._audio_format = audio_format or AudioFormat() if self._streamer is None else self._streamer_format()
# Thread-safe queue of completed clauses plus the _DONE/_ABORT sentinels.
self._queue: "queue.Queue[Any]" = queue.Queue(maxsize=256)
self._handle: Optional[StreamingTTSHandle] = None
diff --cc website/docs/user-guide/features/tts.md
index e49d7d5f621,a7e37623895..65cdf2d7417
--- a/website/docs/user-guide/features/tts.md
+++ b/website/docs/user-guide/features/tts.md
@@@ -56,10 -56,9 +56,11 @@@ tts
model: "gpt-4o-mini-tts"
voice: "alloy" # alloy, echo, fable, onyx, nova, shimmer
base_url: "https://api.openai.com/v1" # Override for OpenAI-compatible TTS endpoints
+ pcm_sample_rate: 24000 # Streaming PCM rate expected from the endpoint (auto-overridden by X-Audio-Sample-Rate)
speed: 1.0 # 0.25 - 4.0
# language: "es" # Sent as lang_code — only for OpenAI-compatible endpoints that support it (e.g. Kokoro)
+ streaming:
+ min_len: 20 # Streaming TTS: shortest first sentence (chars) spoken on its own; CJK setups use ~6
minimax:
region: "global" # "global" or "cn"; see selection rules below
model: "speech-02-hd" # speech-02-hd (default), speech-02-turbo