From d5b34759d732fa0748fdf2614b8db074bc604589 Mon Sep 17 00:00:00 2001 From: Mark Backman Date: Thu, 29 Jan 2026 18:45:18 -0500 Subject: [PATCH] Update GradiumTTSService to flush instead of ending stream --- changelog/3596.fixed.md | 1 + src/pipecat/services/gradium/tts.py | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 changelog/3596.fixed.md diff --git a/changelog/3596.fixed.md b/changelog/3596.fixed.md new file mode 100644 index 000000000..75bdf032b --- /dev/null +++ b/changelog/3596.fixed.md @@ -0,0 +1 @@ +- Fixed an issue in `GradiumTTSService` where the websocket was being disconnected at the end of every bot turn. diff --git a/src/pipecat/services/gradium/tts.py b/src/pipecat/services/gradium/tts.py index df33753ce..7621647d4 100644 --- a/src/pipecat/services/gradium/tts.py +++ b/src/pipecat/services/gradium/tts.py @@ -232,11 +232,15 @@ class GradiumTTSService(InterruptibleWordTTSService): raise Exception("Websocket not connected") async def flush_audio(self): - """Flush any pending audio synthesis.""" + """Flush any pending audio synthesis. + + Sends a tag to force the model to output audio for all text + that has been input so far, without closing the connection. + """ if not self._websocket: return try: - msg = {"type": "end_of_stream"} + msg = {"type": "text", "text": ""} await self._websocket.send(json.dumps(msg)) except ConnectionClosedOK: logger.debug(f"{self}: connection closed normally during flush")