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")