mirror of
https://github.com/open-webui/open-webui
synced 2025-04-22 23:35:26 +00:00
Milvus: new optional config var, MILVUS_TOKEN
modified: backend/open_webui/config.py modified: backend/open_webui/retrieval/vector/dbs/milvus.py
This commit is contained in:
parent
9b640b0ac2
commit
7b31c75271
@ -1325,6 +1325,7 @@ CHROMA_HTTP_SSL = os.environ.get("CHROMA_HTTP_SSL", "false").lower() == "true"
|
|||||||
|
|
||||||
MILVUS_URI = os.environ.get("MILVUS_URI", f"{DATA_DIR}/vector_db/milvus.db")
|
MILVUS_URI = os.environ.get("MILVUS_URI", f"{DATA_DIR}/vector_db/milvus.db")
|
||||||
MILVUS_DB = os.environ.get("MILVUS_DB", "default")
|
MILVUS_DB = os.environ.get("MILVUS_DB", "default")
|
||||||
|
MILVUS_TOKEN = os.environ.get("MILVUS_TOKEN", None)
|
||||||
|
|
||||||
# Qdrant
|
# Qdrant
|
||||||
QDRANT_URI = os.environ.get("QDRANT_URI", None)
|
QDRANT_URI = os.environ.get("QDRANT_URI", None)
|
||||||
|
@ -8,13 +8,17 @@ from open_webui.retrieval.vector.main import VectorItem, SearchResult, GetResult
|
|||||||
from open_webui.config import (
|
from open_webui.config import (
|
||||||
MILVUS_URI,
|
MILVUS_URI,
|
||||||
MILVUS_DB,
|
MILVUS_DB,
|
||||||
|
MILVUS_TOKEN,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class MilvusClient:
|
class MilvusClient:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.collection_prefix = "open_webui"
|
self.collection_prefix = "open_webui"
|
||||||
|
if MILVUS_TOKEN is None:
|
||||||
self.client = Client(uri=MILVUS_URI, database=MILVUS_DB)
|
self.client = Client(uri=MILVUS_URI, database=MILVUS_DB)
|
||||||
|
else:
|
||||||
|
self.client = Client(uri=MILVUS_URI, database=MILVUS_DB, token=MILVUS_TOKEN)
|
||||||
|
|
||||||
def _result_to_get_result(self, result) -> GetResult:
|
def _result_to_get_result(self, result) -> GetResult:
|
||||||
ids = []
|
ids = []
|
||||||
|
Loading…
Reference in New Issue
Block a user