Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/3597.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fixed an issue in `GradiumTTSService` where the websocket was being disconnected at the end of every bot turn.
8 changes: 6 additions & 2 deletions src/pipecat/services/gradium/tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,15 @@ def _get_websocket(self):
raise Exception("Websocket not connected")

async def flush_audio(self):
"""Flush any pending audio synthesis."""
"""Flush any pending audio synthesis.

Sends a <flush> 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": "<flush>"}
await self._websocket.send(json.dumps(msg))
except ConnectionClosedOK:
logger.debug(f"{self}: connection closed normally during flush")
Expand Down