From a66206f44f1c7ba0b702fe65d27e902d407ae704 Mon Sep 17 00:00:00 2001 From: guenhter Date: Thu, 26 Jun 2025 13:52:26 +0200 Subject: [PATCH] feat: support better qdrant collection isolation The prefix string for qdrant collection is now configurable, which means the same qdrant cluster can be used to host more open webui instances and to be able to separate the collections between the different owui instances. --- backend/open_webui/config.py | 1 + backend/open_webui/retrieval/vector/dbs/qdrant.py | 3 ++- backend/open_webui/retrieval/vector/dbs/qdrant_multitenancy.py | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/open_webui/config.py b/backend/open_webui/config.py index 898ac1b594..0700fb7b51 100644 --- a/backend/open_webui/config.py +++ b/backend/open_webui/config.py @@ -1799,6 +1799,7 @@ QDRANT_GRPC_PORT = int(os.environ.get("QDRANT_GRPC_PORT", "6334")) ENABLE_QDRANT_MULTITENANCY_MODE = ( os.environ.get("ENABLE_QDRANT_MULTITENANCY_MODE", "false").lower() == "true" ) +QDRANT_COLLECTION_PREFIX = os.environ.get("QDRANT_COLLECTION_PREFIX", "open-webui") # OpenSearch OPENSEARCH_URI = os.environ.get("OPENSEARCH_URI", "https://localhost:9200") diff --git a/backend/open_webui/retrieval/vector/dbs/qdrant.py b/backend/open_webui/retrieval/vector/dbs/qdrant.py index dfe2979076..54f42ef7a9 100644 --- a/backend/open_webui/retrieval/vector/dbs/qdrant.py +++ b/backend/open_webui/retrieval/vector/dbs/qdrant.py @@ -18,6 +18,7 @@ from open_webui.config import ( QDRANT_ON_DISK, QDRANT_GRPC_PORT, QDRANT_PREFER_GRPC, + QDRANT_COLLECTION_PREFIX, ) from open_webui.env import SRC_LOG_LEVELS @@ -29,7 +30,7 @@ log.setLevel(SRC_LOG_LEVELS["RAG"]) class QdrantClient(VectorDBBase): def __init__(self): - self.collection_prefix = "open-webui" + self.collection_prefix = QDRANT_COLLECTION_PREFIX self.QDRANT_URI = QDRANT_URI self.QDRANT_API_KEY = QDRANT_API_KEY self.QDRANT_ON_DISK = QDRANT_ON_DISK diff --git a/backend/open_webui/retrieval/vector/dbs/qdrant_multitenancy.py b/backend/open_webui/retrieval/vector/dbs/qdrant_multitenancy.py index e83c437ef7..bc8f2ba6a8 100644 --- a/backend/open_webui/retrieval/vector/dbs/qdrant_multitenancy.py +++ b/backend/open_webui/retrieval/vector/dbs/qdrant_multitenancy.py @@ -9,6 +9,7 @@ from open_webui.config import ( QDRANT_ON_DISK, QDRANT_PREFER_GRPC, QDRANT_URI, + QDRANT_COLLECTION_PREFIX, ) from open_webui.env import SRC_LOG_LEVELS from open_webui.retrieval.vector.main import ( @@ -30,7 +31,7 @@ log.setLevel(SRC_LOG_LEVELS["RAG"]) class QdrantClient(VectorDBBase): def __init__(self): - self.collection_prefix = "open-webui" + self.collection_prefix = QDRANT_COLLECTION_PREFIX self.QDRANT_URI = QDRANT_URI self.QDRANT_API_KEY = QDRANT_API_KEY self.QDRANT_ON_DISK = QDRANT_ON_DISK