update: 视觉模块直接识别输出,不经过二次LLM

This commit is contained in:
Sakura-RanChen
2025-06-17 16:13:24 +08:00
parent d8bf5cdedf
commit 1a31c8cd1d
2 changed files with 21 additions and 4 deletions
@@ -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(