mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-26 00:53:54 +08:00
update:视觉结果优化
This commit is contained in:
@@ -37,6 +37,24 @@ class DeviceMCPExecutor(ToolExecutor):
|
|||||||
# 调用设备端MCP工具
|
# 调用设备端MCP工具
|
||||||
result = await call_mcp_tool(conn, conn.mcp_client, tool_name, args_str)
|
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))
|
return ActionResponse(action=Action.REQLLM, result=str(result))
|
||||||
|
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user