Fix interruption frame to avoid issues with sending None
This commit is contained in:
@@ -210,9 +210,10 @@ class CartesiaTTSService(WordTTSService):
|
|||||||
async def _handle_interruption(self, frame: StartInterruptionFrame, direction: FrameDirection):
|
async def _handle_interruption(self, frame: StartInterruptionFrame, direction: FrameDirection):
|
||||||
await super()._handle_interruption(frame, direction)
|
await super()._handle_interruption(frame, direction)
|
||||||
await self.stop_all_metrics()
|
await self.stop_all_metrics()
|
||||||
cancel_msg = json.dumps({"context_id": self._context_id, "cancel": True})
|
if not self._context_id:
|
||||||
await self._get_websocket().send(cancel_msg)
|
cancel_msg = json.dumps({"context_id": self._context_id, "cancel": True})
|
||||||
self._context_id = None
|
await self._get_websocket().send(cancel_msg)
|
||||||
|
self._context_id = None
|
||||||
|
|
||||||
async def flush_audio(self):
|
async def flush_audio(self):
|
||||||
if not self._context_id or not self._websocket:
|
if not self._context_id or not self._websocket:
|
||||||
|
|||||||
Reference in New Issue
Block a user