From 0a54124d0d4a1052506df49cd3323864c402d235 Mon Sep 17 00:00:00 2001 From: hrz <1710360675@qq.com> Date: Sat, 17 Oct 2026 07:57:26 +0800 Subject: [PATCH] =?UTF-8?q?huoshan=5Fdouble=5Fstream=20=E4=BF=AE=203=20?= =?UTF-8?q?=E5=A4=84=E5=A4=8D=E8=AF=84=E5=8F=8D=E9=A6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit init 漏写 _pending_prefix 字段、start_session 用已弃用的 get_event_loop、finish_session 留着多余的 getattr 兜底。补字段、 换 get_running_loop、去兜底,3 处都修了。 --- .../core/providers/tts/huoshan_double_stream.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main/xiaozhi-server/core/providers/tts/huoshan_double_stream.py b/main/xiaozhi-server/core/providers/tts/huoshan_double_stream.py index 5442f7888..649d4994d 100644 --- a/main/xiaozhi-server/core/providers/tts/huoshan_double_stream.py +++ b/main/xiaozhi-server/core/providers/tts/huoshan_double_stream.py @@ -145,6 +145,7 @@ class TTSProvider(TTSProviderBase): self.interface_type = InterfaceType.DUAL_STREAM self._monitor_task = None # 监听任务引用 self._session_start_future: asyncio.Future | None = None + self._pending_prefix = "" self.appId = config.get("appid") self.access_token = config.get("access_token") self.cluster = config.get("cluster") @@ -429,7 +430,7 @@ class TTSProvider(TTSProviderBase): logger.bind(tag=TAG).debug("会话启动请求已发送") # 等 monitor 读到 SessionStarted / SessionFailed 帧,失败 / 超时让文本线程感知 - loop = asyncio.get_event_loop() + loop = asyncio.get_running_loop() self._session_start_future = loop.create_future() try: ok = await asyncio.wait_for( @@ -453,7 +454,7 @@ class TTSProvider(TTSProviderBase): try: if self.ws: # 句尾替换词滑动窗口残留先发出去 - if getattr(self, "_pending_prefix", ""): + if self._pending_prefix: await self.text_to_speak(self._pending_prefix, None) header = Header( message_type=FULL_CLIENT_REQUEST,