Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix API tool's schema not support array (#6006)

非法操作bf2268b0af27
diff --git a/api/core/tools/tool/api_tool.py b/api/core/tools/tool/api_tool.py
index 0448a5df0c6..c8b683f9ef1 100644
--- a/api/core/tools/tool/api_tool.py
+++ b/api/core/tools/tool/api_tool.py
@@ -249,9 +249,12 @@ class ApiTool(Tool):
elif property['type'] == 'null':
if value is None:
return None
- elif property['type'] == 'object':
+ elif property['type'] == 'object' or property['type'] == 'array':
if isinstance(value, str):
try:
+ # an array str like '[1,2]' also can convert to list [1,2] through json.loads
+ # json not support single quote, but we can support it
+ value = value.replace("'", '"')
return json.loads(value)
except ValueError:
return value