fix(agent): remove binary format from view_image schema (#7475)

This commit is contained in:
jxxghp
2026-11-19 11:09:41 +08:00
parent 9e22b10097
commit 9bbefd5f45
2 changed files with 6 additions and 3 deletions

View File

@@ -64,9 +64,9 @@ class ViewImageInput(BaseModel):
None,
description="本地图片路径;非管理员仅可读取 Agent 配置目录内文件",
)
image_data: Optional[Union[str, bytes]] = Field(
image_data: Optional[str] = Field(
None,
description="Base64 图片内容、data:image/...;base64,... 或原始图片字节;只能选择一种图片来源",
description="Base64 图片内容或 data:image/...;base64,...;只能选择一种图片来源",
)
detail: Literal['auto', 'low', 'high'] = Field(
"auto",
@@ -104,7 +104,7 @@ class ViewImageTool(MoviePilotTool):
default=(
"将图片的实际像素提供给多模态模型查看。"
"url、file_path 和 image_data 必须且只能提供一项。"
"支持公网 HTTP(S) 图片地址、data:image/...;base64,... 地址、Base64 或原始图片内容以及本地路径。"
"支持公网 HTTP(S) 图片地址、data:image/...;base64,... 地址、Base64 图片内容以及本地路径。"
"本地读取遵守 Agent 文件权限边界,禁止私网 URL。"
"需要视觉检查时使用;"
"只有工具返回图片观察结果后才能声称已查看图片。"

View File

@@ -139,6 +139,9 @@ def test_non_gemini_requests_preserve_nullable_tool_parameters(
assert skill["properties"]["file"]["anyOf"] == [{"type": "string"}, {"type": "null"}]
assert skill["required"] == (["name", "file"] if bind_kwargs.get("strict") else ["name"])
image_data = _parameters(tools, "view_image")["properties"]["image_data"]
assert image_data["anyOf"] == [{"type": "string"}, {"type": "null"}]
def test_optional_fields_collapse_to_single_type_for_gemini_models() -> None:
"""