Просмотр исходного кода

fix: move _drain_queue to module level after Worker class

wenhongquan 3 недель назад
Родитель
Сommit
beea2f5be1
1 измененных файлов с 9 добавлено и 16 удалено
  1. 9 16
      asr_agent/conversation_worker.py

+ 9 - 16
asr_agent/conversation_worker.py

@@ -666,22 +666,6 @@ class Worker:
         except Exception:
             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
 
 
@@ -696,3 +680,12 @@ async def main():
 
 if __name__ == "__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
+