Update GradiumTTSService to flush instead of ending stream
This commit is contained in:
1
changelog/3596.fixed.md
Normal file
1
changelog/3596.fixed.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
- Fixed an issue in `GradiumTTSService` where the websocket was being disconnected at the end of every bot turn.
|
||||||
@@ -232,11 +232,15 @@ class GradiumTTSService(InterruptibleWordTTSService):
|
|||||||
raise Exception("Websocket not connected")
|
raise Exception("Websocket not connected")
|
||||||
|
|
||||||
async def flush_audio(self):
|
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:
|
if not self._websocket:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
msg = {"type": "end_of_stream"}
|
msg = {"type": "text", "text": "<flush>"}
|
||||||
await self._websocket.send(json.dumps(msg))
|
await self._websocket.send(json.dumps(msg))
|
||||||
except ConnectionClosedOK:
|
except ConnectionClosedOK:
|
||||||
logger.debug(f"{self}: connection closed normally during flush")
|
logger.debug(f"{self}: connection closed normally during flush")
|
||||||
|
|||||||
Reference in New Issue
Block a user