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: prevent KeyError in validate_api_list by correcting logical check (#23126)

Yongtao Huanga51998e4aa0c
diff --git a/api/services/external_knowledge_service.py b/api/services/external_knowledge_service.py
index b7af03e91f2..2f1babba6fa 100644
--- a/api/services/external_knowledge_service.py
+++ b/api/services/external_knowledge_service.py
@@ -46,9 +46,9 @@ class ExternalDatasetService:
def validate_api_list(cls, api_settings: dict):
if not api_settings:
raise ValueError("api list is empty")
- if "endpoint" not in api_settings and not api_settings["endpoint"]:
+ if not api_settings.get("endpoint"):
raise ValueError("endpoint is required")
- if "api_key" not in api_settings and not api_settings["api_key"]:
+ if not api_settings.get("api_key"):
raise ValueError("api_key is required")
@staticmethod