From da8435cfea1c7c04e2095bfa2fceaf0a19ef6c83 Mon Sep 17 00:00:00 2001 From: hrz <1710360675@qq.com> Date: Thu, 26 Jun 2025 11:42:13 +0800 Subject: [PATCH] =?UTF-8?q?update:=E8=A7=86=E8=A7=89=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../providers/tools/device_mcp/mcp_executor.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/main/xiaozhi-server/core/providers/tools/device_mcp/mcp_executor.py b/main/xiaozhi-server/core/providers/tools/device_mcp/mcp_executor.py index 4de1eecb..9f4be061 100644 --- a/main/xiaozhi-server/core/providers/tools/device_mcp/mcp_executor.py +++ b/main/xiaozhi-server/core/providers/tools/device_mcp/mcp_executor.py @@ -37,6 +37,24 @@ class DeviceMCPExecutor(ToolExecutor): # 调用设备端MCP工具 result = await call_mcp_tool(conn, conn.mcp_client, tool_name, args_str) + resultJson = None + if isinstance(result, str): + try: + resultJson = json.loads(result) + except Exception as e: + pass + + # 视觉大模型不经过二次LLM处理 + if ( + resultJson is not None + and isinstance(resultJson, dict) + and "action" in resultJson + ): + return ActionResponse( + action=Action[resultJson["action"]], + response=resultJson.get("response", ""), + ) + return ActionResponse(action=Action.REQLLM, result=str(result)) except ValueError as e: