From 9fd35016055ae17cf7b11fd6502c976a42520480 Mon Sep 17 00:00:00 2001 From: Sakura-RanChen <1908198662@qq.com> Date: Wed, 4 Feb 2026 10:28:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=AE=AF=E9=A3=9E=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E9=80=82=E5=BA=94=EF=BC=8C=E9=98=BF=E9=87=8C?= =?UTF-8?q?=E4=BA=91=E7=AD=89=E5=BE=85=E6=97=B6=E6=9C=BA=E8=BF=87=E7=9F=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/xiaozhi-server/core/providers/asr/aliyun_stream.py | 6 +++--- main/xiaozhi-server/core/providers/asr/xunfei_stream.py | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/main/xiaozhi-server/core/providers/asr/aliyun_stream.py b/main/xiaozhi-server/core/providers/asr/aliyun_stream.py index f65d2b4e..fe334bce 100644 --- a/main/xiaozhi-server/core/providers/asr/aliyun_stream.py +++ b/main/xiaozhi-server/core/providers/asr/aliyun_stream.py @@ -144,7 +144,7 @@ class ASRProvider(ASRProviderBase): await self.asr_ws.send(pcm_frame) except Exception as e: logger.bind(tag=TAG).warning(f"发送音频失败: {str(e)}") - await self._cleanup(conn) + await self._cleanup() async def _start_recognition(self, conn): """开始识别会话""" @@ -199,7 +199,7 @@ class ASRProvider(ASRProviderBase): # 获取当前连接的音频数据 audio_data = conn.asr_audio try: - response = await asyncio.wait_for(self.asr_ws.recv(), timeout=1.0) + response = await self.asr_ws.recv() result = json.loads(response) header = result.get("header", {}) @@ -332,7 +332,7 @@ class ASRProvider(ASRProviderBase): async def close(self): """关闭资源""" - await self._cleanup(None) + await self._cleanup() if hasattr(self, 'decoder') and self.decoder is not None: try: del self.decoder diff --git a/main/xiaozhi-server/core/providers/asr/xunfei_stream.py b/main/xiaozhi-server/core/providers/asr/xunfei_stream.py index 31087542..7994c661 100644 --- a/main/xiaozhi-server/core/providers/asr/xunfei_stream.py +++ b/main/xiaozhi-server/core/providers/asr/xunfei_stream.py @@ -226,9 +226,8 @@ class ASRProvider(ASRProviderBase): self.text += w if status == 2: - if conn.client_listen_mode == "manual": - logger.bind(tag=TAG).debug("收到最终识别结果,触发处理") - await self.handle_voice_stop(conn, conn.asr_audio) + logger.bind(tag=TAG).debug("收到最终识别结果,触发处理") + await self.handle_voice_stop(conn, conn.asr_audio) break except asyncio.TimeoutError: