From ca63ae649c6877488fc47bb84f97d69db5c1214d Mon Sep 17 00:00:00 2001 From: Matthew Hand Date: Fri, 15 Nov 2024 07:06:46 +1100 Subject: [PATCH] Enable Qdrant authentication support --- backend/open_webui/apps/retrieval/vector/dbs/qdrant.py | 8 ++++++-- backend/open_webui/config.py | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/backend/open_webui/apps/retrieval/vector/dbs/qdrant.py b/backend/open_webui/apps/retrieval/vector/dbs/qdrant.py index c1e06872f..7de23a107 100644 --- a/backend/open_webui/apps/retrieval/vector/dbs/qdrant.py +++ b/backend/open_webui/apps/retrieval/vector/dbs/qdrant.py @@ -5,7 +5,7 @@ from qdrant_client.http.models import PointStruct from qdrant_client.models import models from open_webui.apps.retrieval.vector.main import VectorItem, SearchResult, GetResult -from open_webui.config import QDRANT_URI +from open_webui.config import QDRANT_URI, QDRANT_API_KEY NO_LIMIT = 999999999 @@ -14,7 +14,11 @@ class QdrantClient: def __init__(self): self.collection_prefix = "open-webui" self.QDRANT_URI = QDRANT_URI - self.client = Qclient(url=self.QDRANT_URI) if self.QDRANT_URI else None + self.QDRANT_API_KEY = QDRANT_API_KEY + self.client = Qclient( + url=self.QDRANT_URI, + api_key=self.QDRANT_API_KEY + ) if self.QDRANT_URI else None def _result_to_get_result(self, points) -> GetResult: ids = [] diff --git a/backend/open_webui/config.py b/backend/open_webui/config.py index 9d1bd72d8..75a83f90c 100644 --- a/backend/open_webui/config.py +++ b/backend/open_webui/config.py @@ -954,6 +954,7 @@ MILVUS_URI = os.environ.get("MILVUS_URI", f"{DATA_DIR}/vector_db/milvus.db") # Qdrant QDRANT_URI = os.environ.get("QDRANT_URI", None) +QDRANT_API_KEY = os.environ.get("QDRANT_API_KEY", None) #################################### # Information Retrieval (RAG)