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.

Remove the second `if self.runtime is None:` check (#24171)

Yongtao Huang7c7618c083cb
diff --git a/api/core/tools/custom_tool/tool.py b/api/core/tools/custom_tool/tool.py
index e112de95781..3c0bfa52408 100644
--- a/api/core/tools/custom_tool/tool.py
+++ b/api/core/tools/custom_tool/tool.py
@@ -81,14 +81,11 @@ class ApiTool(Tool):
return ToolProviderType.API
def assembling_request(self, parameters: dict[str, Any]) -> dict[str, Any]:
+ headers = {}
if self.runtime is None:
raise ToolProviderCredentialValidationError("runtime not initialized")
- headers = {}
- if self.runtime is None:
- raise ValueError("runtime is required")
credentials = self.runtime.credentials or {}
-
if "auth_type" not in credentials:
raise ToolProviderCredentialValidationError("Missing auth_type")
diff --git a/api/core/tools/entities/api_entities.py b/api/core/tools/entities/api_entities.py
index 27ce96b90ee..48015c04eeb 100644
--- a/api/core/tools/entities/api_entities.py
+++ b/api/core/tools/entities/api_entities.py
@@ -62,7 +62,7 @@ class ToolProviderApiEntity(BaseModel):
parameter.pop("input_schema", None)
# -------------
optional_fields = self.optional_field("server_url", self.server_url)
- if self.type == ToolProviderType.MCP.value:
+ if self.type == ToolProviderType.MCP:
optional_fields.update(self.optional_field("updated_at", self.updated_at))
optional_fields.update(self.optional_field("server_identifier", self.server_identifier))
return {