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.

Fixed: The use of default parameters in API interfaces (#14138)

feiyang_deepnovac4f4dfc3fb2c
diff --git a/api/core/tools/custom_tool/tool.py b/api/core/tools/custom_tool/tool.py
index f8467c54c5e..2d8c6bb5afd 100644
--- a/api/core/tools/custom_tool/tool.py
+++ b/api/core/tools/custom_tool/tool.py
@@ -105,10 +105,10 @@ class ApiTool(Tool):
needed_parameters = [parameter for parameter in (self.api_bundle.parameters or []) if parameter.required]
for parameter in needed_parameters:
if parameter.required and parameter.name not in parameters:
- raise ToolParameterValidationError(f"Missing required parameter {parameter.name}")
-
- if parameter.default is not None and parameter.name not in parameters:
- parameters[parameter.name] = parameter.default
+ if parameter.default is not None:
+ parameters[parameter.name] = parameter.default
+ else:
+ raise ToolParameterValidationError(f"Missing required parameter {parameter.name}")
return headers