Merge pull request #1609 from xinnan-tech/py_fix_type

Py fix type
This commit is contained in:
hrz
2025-06-18 09:39:38 +08:00
committed by GitHub
4 changed files with 26 additions and 5 deletions
@@ -56,6 +56,9 @@ public class AgentTemplateServiceImpl extends ServiceImpl<AgentTemplateDao, Agen
wrapper.set("tts_model_id", modelId);
wrapper.set("tts_voice_id", null);
break;
case "VLLM":
wrapper.set("vllm_model_id", modelId);
break;
case "MEMORY":
wrapper.set("mem_model_id", modelId);
break;
@@ -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(
+18 -3
View File
@@ -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(
@@ -31,7 +31,8 @@ hass_set_state_function_desc = {
"description": "只有在设置静音操作时才需要,设置静音的时候该值为true,取消静音时该值为false",
},
"rgb_color": {
"type": "list",
"type": "array",
"items": {"type": "integer"},
"description": "只有在设置颜色时需要,这里填目标颜色的rgb值",
},
},