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.

Fixes #20534: Allow $ref in parameter for custom tools (#20535)

不如归去8025ad06613d
diff --git a/api/core/tools/utils/parser.py b/api/core/tools/utils/parser.py
index f72291783af..3f844e82346 100644
--- a/api/core/tools/utils/parser.py
+++ b/api/core/tools/utils/parser.py
@@ -55,6 +55,13 @@ class ApiBasedToolSchemaParser:
# convert parameters
parameters = []
if "parameters" in interface["operation"]:
+ for i, parameter in enumerate(interface["operation"]["parameters"]):
+ if "$ref" in parameter:
+ root = openapi
+ reference = parameter["$ref"].split("/")[1:]
+ for ref in reference:
+ root = root[ref]
+ interface["operation"]["parameters"][i] = root
for parameter in interface["operation"]["parameters"]:
tool_parameter = ToolParameter(
name=parameter["name"],