Merge pull request #793 from balalofernandez/send-interruption-to-cartesia

fix: Send interruption to cartesia
This commit is contained in:
Aleix Conchillo Flaqué
2024-12-06 10:26:34 -08:00
committed by GitHub

View File

@@ -227,7 +227,10 @@ class CartesiaTTSService(WordTTSService):
async def _handle_interruption(self, frame: StartInterruptionFrame, direction: FrameDirection):
await super()._handle_interruption(frame, direction)
await self.stop_all_metrics()
self._context_id = None
if not self._context_id:
cancel_msg = json.dumps({"context_id": self._context_id, "cancel": True})
await self._get_websocket().send(cancel_msg)
self._context_id = None
async def flush_audio(self):
if not self._context_id or not self._websocket: