From d8bf5cdedf9f8f5389c059de451bf1cb4a2d8e13 Mon Sep 17 00:00:00 2001 From: Sakura-RanChen <1908198662@qq.com> Date: Mon, 16 Jun 2025 16:26:49 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20openAi=20schema=E4=B8=8D=E6=94=AF?= =?UTF-8?q?=E6=8C=81list?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/xiaozhi-server/plugins_func/functions/hass_set_state.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main/xiaozhi-server/plugins_func/functions/hass_set_state.py b/main/xiaozhi-server/plugins_func/functions/hass_set_state.py index 30b2ac45..704148ee 100644 --- a/main/xiaozhi-server/plugins_func/functions/hass_set_state.py +++ b/main/xiaozhi-server/plugins_func/functions/hass_set_state.py @@ -31,7 +31,8 @@ hass_set_state_function_desc = { "description": "只有在设置静音操作时才需要,设置静音的时候该值为true,取消静音时该值为false", }, "rgb_color": { - "type": "list", + "type": "array", + "items": {"type": "integer"}, "description": "只有在设置颜色时需要,这里填目标颜色的rgb值", }, }, From 1a31c8cd1d4099238104d505881ab1bad94acb06 Mon Sep 17 00:00:00 2001 From: Sakura-RanChen <1908198662@qq.com> Date: Tue, 17 Jun 2025 16:13:24 +0800 Subject: [PATCH 2/3] =?UTF-8?q?update:=20=E8=A7=86=E8=A7=89=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E7=9B=B4=E6=8E=A5=E8=AF=86=E5=88=AB=E8=BE=93=E5=87=BA?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E7=BB=8F=E8=BF=87=E4=BA=8C=E6=AC=A1LLM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xiaozhi-server/core/api/vision_handler.py | 4 +++- main/xiaozhi-server/core/connection.py | 21 ++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/main/xiaozhi-server/core/api/vision_handler.py b/main/xiaozhi-server/core/api/vision_handler.py index 55dd22a3..70be247a 100644 --- a/main/xiaozhi-server/core/api/vision_handler.py +++ b/main/xiaozhi-server/core/api/vision_handler.py @@ -8,6 +8,7 @@ from config.config_loader import get_private_config_from_api from core.utils.auth import AuthToken import base64 from typing import Tuple, Optional +from plugins_func.register import Action TAG = __name__ @@ -122,7 +123,8 @@ class VisionHandler: return_json = { "success": True, - "result": result, + "action": Action.RESPONSE.name, + "response": result, } response = web.Response( diff --git a/main/xiaozhi-server/core/connection.py b/main/xiaozhi-server/core/connection.py index 60a7a283..7928d1cf 100644 --- a/main/xiaozhi-server/core/connection.py +++ b/main/xiaozhi-server/core/connection.py @@ -751,9 +751,24 @@ class ConnectionHandler: self.loop, ).result() self.logger.bind(tag=TAG).debug(f"MCP工具调用结果: {result}") - result = ActionResponse( - action=Action.REQLLM, result=result, response="" - ) + + if isinstance(result, str): + try: + result = json.loads(result) + except Exception as e: + self.logger.bind(tag=TAG).error(f"解析MCP工具返回结果失败: {e}") + + # 视觉大模型不经过二次LLM处理 + if isinstance(result, dict) and "action" in result: + result = ActionResponse( + action=Action[result["action"]], + result=None, + response=result.get("response", "") + ) + else: + result = ActionResponse( + action=Action.REQLLM, result=result, response="" + ) except Exception as e: self.logger.bind(tag=TAG).error(f"MCP工具调用失败: {e}") result = ActionResponse( From fb1f476a3c3e92fd30497dbe42b729129b6bb05c Mon Sep 17 00:00:00 2001 From: Sakura-RanChen <1908198662@qq.com> Date: Wed, 18 Jun 2025 09:24:52 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=E6=99=BA=E6=8E=A7=E5=8F=B0=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E9=BB=98=E8=AE=A4=E8=A7=86=E8=A7=89=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/agent/service/impl/AgentTemplateServiceImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentTemplateServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentTemplateServiceImpl.java index 9ac3de25..581adbdd 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentTemplateServiceImpl.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentTemplateServiceImpl.java @@ -56,6 +56,9 @@ public class AgentTemplateServiceImpl extends ServiceImpl