|
@@ -666,22 +666,6 @@ class Worker:
|
|
|
except Exception:
|
|
except Exception:
|
|
|
logger.exception("TTS failed")
|
|
logger.exception("TTS failed")
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- def _drain_queue(q: "asyncio.Queue") -> None:
|
|
|
|
|
- """Discard any queued-but-not-yet-played TTS audio."""
|
|
|
|
|
- while not q.empty():
|
|
|
|
|
- try:
|
|
|
|
|
- q.get_nowait()
|
|
|
|
|
- except Exception:
|
|
|
|
|
- break
|
|
|
|
|
-
|
|
|
|
|
- async def _send(self, msg: dict):
|
|
|
|
|
- try:
|
|
|
|
|
- await self.room.local_participant.publish_data(
|
|
|
|
|
- json.dumps(msg, ensure_ascii=False).encode(),
|
|
|
|
|
- reliable=True, topic="transcription",
|
|
|
|
|
- )
|
|
|
|
|
- except Exception:
|
|
|
|
|
pass
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
@@ -696,3 +680,12 @@ async def main():
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
if __name__ == "__main__":
|
|
|
asyncio.run(main())
|
|
asyncio.run(main())
|
|
|
|
|
+
|
|
|
|
|
+def _drain_queue(q: "asyncio.Queue") -> None:
|
|
|
|
|
+ """Discard any queued-but-not-yet-played TTS audio."""
|
|
|
|
|
+ while not q.empty():
|
|
|
|
|
+ try:
|
|
|
|
|
+ q.get_nowait()
|
|
|
|
|
+ except Exception:
|
|
|
|
|
+ break
|
|
|
|
|
+
|