From 1cde84273be037297bf1241db7b9d1ce17dcfa38 Mon Sep 17 00:00:00 2001 From: JOJO <1498581755@qq.com> Date: Wed, 29 Jul 2026 11:45:22 +0800 Subject: [PATCH] =?UTF-8?q?fix(tools):=20view=5Fimage=20=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=20svg=20=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 工具描述与执行层 allowed_ext 同步去掉 svg,调用 svg 返回不支持的图片格式 --- core/main_terminal_parts/tools_definition/main.py | 2 +- core/main_terminal_parts/tools_execution.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/main_terminal_parts/tools_definition/main.py b/core/main_terminal_parts/tools_definition/main.py index c9bfc47e..a5b46392 100644 --- a/core/main_terminal_parts/tools_definition/main.py +++ b/core/main_terminal_parts/tools_definition/main.py @@ -114,7 +114,7 @@ class ToolsDefinitionMainMixin: "properties": self._inject_intent({ "path": { "type": "string", - "description": "项目内的图片相对路径(不要以 /workspace 开头);宿主机模式可用绝对路径。支持 png/jpg/webp/gif/bmp/svg。" + "description": "项目内的图片相对路径(不要以 /workspace 开头);宿主机模式可用绝对路径。支持 png/jpg/webp/gif/bmp。" } }), "required": ["path"] diff --git a/core/main_terminal_parts/tools_execution.py b/core/main_terminal_parts/tools_execution.py index ac4b4188..edd96f05 100644 --- a/core/main_terminal_parts/tools_execution.py +++ b/core/main_terminal_parts/tools_execution.py @@ -1073,7 +1073,7 @@ class MainTerminalToolsExecutionMixin: return json.dumps({"success": False, "error": f"图片不存在: {path}"}, ensure_ascii=False) if abs_path.stat().st_size > 10 * 1024 * 1024: return json.dumps({"success": False, "error": "图片过大,需 <= 10MB"}, ensure_ascii=False) - allowed_ext = {".png", ".jpg", ".jpeg", ".webp", ".gif", ".bmp", ".svg"} + allowed_ext = {".png", ".jpg", ".jpeg", ".webp", ".gif", ".bmp"} if abs_path.suffix.lower() not in allowed_ext: return json.dumps({"success": False, "error": f"不支持的图片格式: {abs_path.suffix}"}, ensure_ascii=False) # 记录待附加图片,供上层将图片附加到工具结果