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.

feat: add authorizations for swagger doc (#24518)

非法操作d7869a4d1eec
diff --git a/api/libs/external_api.py b/api/libs/external_api.py
index 95d13cd0e65..d5e3c76d20b 100644
--- a/api/libs/external_api.py
+++ b/api/libs/external_api.py
@@ -106,6 +106,17 @@ def register_external_error_handlers(api: Api) -> None:
class ExternalApi(Api):
+ _authorizations = {
+ "Bearer": {
+ "type": "apiKey",
+ "in": "header",
+ "name": "Authorization",
+ "description": "Type: Bearer {your-api-key}",
+ }
+ }
+
def __init__(self, *args, **kwargs):
+ kwargs.setdefault("authorizations", self._authorizations)
+ kwargs.setdefault("security", "Bearer")
super().__init__(*args, **kwargs)
register_external_error_handlers(self)