Skip to content

Commit bf6a8db

Browse files
authored
🐛 Repairing Multimodal Tools Cannot Export
2 parents 862866e + 250e996 commit bf6a8db

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

backend/services/agent_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ async def export_agent_by_agent_id(agent_id: int, tenant_id: str, user_id: str)
844844

845845
# Check if any tool is KnowledgeBaseSearchTool and set its metadata to empty dict
846846
for tool in tool_list:
847-
if tool.class_name == "KnowledgeBaseSearchTool":
847+
if tool.class_name in ["KnowledgeBaseSearchTool", "AnalyzeTextFileTool", "AnalyzeImageTool"]:
848848
tool.metadata = {}
849849

850850
# Get model_id and model display name from agent_info

test/backend/services/test_agent_service.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1781,6 +1781,28 @@ async def test_export_agent_by_agent_id_success(mock_search_agent_info, mock_cre
17811781
output_type="search results",
17821782
usage=None
17831783
),
1784+
ToolConfig(
1785+
class_name="AnalyzeTextFileTool",
1786+
name="Text Analyzer",
1787+
source="source3",
1788+
params={"param4": "value4"},
1789+
metadata={"text": "data"},
1790+
description="Text analysis tool",
1791+
inputs="text file",
1792+
output_type="analysis",
1793+
usage=None
1794+
),
1795+
ToolConfig(
1796+
class_name="AnalyzeImageTool",
1797+
name="Image Analyzer",
1798+
source="source4",
1799+
params={"param5": "value5"},
1800+
metadata={"image": "data"},
1801+
description="Image analysis tool",
1802+
inputs="image file",
1803+
output_type="analysis result",
1804+
usage=None
1805+
),
17841806
ToolConfig(
17851807
class_name="MCPTool",
17861808
name="MCP Tool",
@@ -1810,14 +1832,22 @@ async def test_export_agent_by_agent_id_success(mock_search_agent_info, mock_cre
18101832
assert result.agent_id == 123
18111833
assert result.name == "Test Agent"
18121834
assert result.business_description == "For testing purposes"
1813-
assert len(result.tools) == 3
1835+
assert len(result.tools) == 5
18141836
assert result.managed_agents == mock_sub_agent_ids
18151837

18161838
# Verify KnowledgeBaseSearchTool metadata is empty
18171839
knowledge_tool = next(
18181840
tool for tool in result.tools if tool.class_name == "KnowledgeBaseSearchTool")
18191841
assert knowledge_tool.metadata == {}
18201842

1843+
analyze_text_tool = next(
1844+
tool for tool in result.tools if tool.class_name == "AnalyzeTextFileTool")
1845+
assert analyze_text_tool.metadata == {}
1846+
1847+
analyze_image_tool = next(
1848+
tool for tool in result.tools if tool.class_name == "AnalyzeImageTool")
1849+
assert analyze_image_tool.metadata == {}
1850+
18211851
# Verify MCP tool has usage field
18221852
mcp_tool = next(
18231853
tool for tool in result.tools if tool.class_name == "MCPTool")

0 commit comments

Comments
 (0)