From 3d6bd0e23e0c8fa6a1c09c4feea57711769f1183 Mon Sep 17 00:00:00 2001 From: vonweller <154695311+vonweller@users.noreply.github.com> Date: Tue, 11 Mar 2025 21:10:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DActionResponse=E4=B8=BANOTFOU?= =?UTF-8?q?ND=E6=97=B6=E5=80=99=E5=8D=A1=E4=BD=8F=E4=B8=BB=E7=BA=BF?= =?UTF-8?q?=E7=A8=8B=E7=9A=84bug=20(#285)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复ActionResponse为NOTFOUND时候卡住主线程的bug --- main/xiaozhi-server/core/connection.py | 3 +++ main/xiaozhi-server/core/handle/intentHandler.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/main/xiaozhi-server/core/connection.py b/main/xiaozhi-server/core/connection.py index 80c62336..65696403 100644 --- a/main/xiaozhi-server/core/connection.py +++ b/main/xiaozhi-server/core/connection.py @@ -437,6 +437,9 @@ class ConnectionHandler: self.dialogue.put(Message(role="assistant", content=text)) if result.action == Action.REQLLM: # 调用函数后再请求llm生成回复 text = result.response + if result.action == Action.NOTFOUND: + text = result.response + def _tts_priority_thread(self): diff --git a/main/xiaozhi-server/core/handle/intentHandler.py b/main/xiaozhi-server/core/handle/intentHandler.py index 2dde6255..da0f5c91 100644 --- a/main/xiaozhi-server/core/handle/intentHandler.py +++ b/main/xiaozhi-server/core/handle/intentHandler.py @@ -67,7 +67,7 @@ def handle_llm_function_call(conn, function_call_data): except Exception as e: logger.bind(tag=TAG).error(f"处理音乐意图错误: {e}") else: - return ActionResponse(action=Action.NOTFOUND, result="没有找到对应的函数", response="") + return ActionResponse(action=Action.NOTFOUND, result="没有找到对应的函数", response="没有找到对应的函数处理相对于的功能呢,你可以需要添加预设的对应函数处理呢") except Exception as e: logger.bind(tag=TAG).error(f"处理function call错误: {e}")