fix(tools): view_image 移除 svg 支持
工具描述与执行层 allowed_ext 同步去掉 svg,调用 svg 返回不支持的图片格式
This commit is contained in:
parent
91347d5245
commit
1cde84273b
@ -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"]
|
||||
|
||||
@ -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)
|
||||
# 记录待附加图片,供上层将图片附加到工具结果
|
||||
|
||||
Loading…
Reference in New Issue
Block a user