mirror of
https://github.com/open-webui/open-webui
synced 2024-11-17 05:53:11 +00:00
feature to support authentication in chromadb
This commit is contained in:
parent
21b8ca3459
commit
3d0c32f366
@ -13,11 +13,22 @@ from open_webui.config import (
|
|||||||
CHROMA_HTTP_SSL,
|
CHROMA_HTTP_SSL,
|
||||||
CHROMA_TENANT,
|
CHROMA_TENANT,
|
||||||
CHROMA_DATABASE,
|
CHROMA_DATABASE,
|
||||||
|
CHROMA_CLIENT_AUTH_PROVIDER,
|
||||||
|
CHROMA_CLIENT_AUTH_CREDENTIALS,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ChromaClient:
|
class ChromaClient:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
settings_dict = {
|
||||||
|
"allow_reset": True,
|
||||||
|
"anonymized_telemetry": False,
|
||||||
|
}
|
||||||
|
if CHROMA_CLIENT_AUTH_PROVIDER is not None:
|
||||||
|
settings_dict["chroma_client_auth_provider"] = CHROMA_CLIENT_AUTH_PROVIDER
|
||||||
|
if CHROMA_CLIENT_AUTH_CREDENTIALS is not None:
|
||||||
|
settings_dict["chroma_client_auth_credentials"] = CHROMA_CLIENT_AUTH_CREDENTIALS
|
||||||
|
|
||||||
if CHROMA_HTTP_HOST != "":
|
if CHROMA_HTTP_HOST != "":
|
||||||
self.client = chromadb.HttpClient(
|
self.client = chromadb.HttpClient(
|
||||||
host=CHROMA_HTTP_HOST,
|
host=CHROMA_HTTP_HOST,
|
||||||
@ -26,12 +37,12 @@ class ChromaClient:
|
|||||||
ssl=CHROMA_HTTP_SSL,
|
ssl=CHROMA_HTTP_SSL,
|
||||||
tenant=CHROMA_TENANT,
|
tenant=CHROMA_TENANT,
|
||||||
database=CHROMA_DATABASE,
|
database=CHROMA_DATABASE,
|
||||||
settings=Settings(allow_reset=True, anonymized_telemetry=False),
|
settings=Settings(**settings_dict),
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
self.client = chromadb.PersistentClient(
|
self.client = chromadb.PersistentClient(
|
||||||
path=CHROMA_DATA_PATH,
|
path=CHROMA_DATA_PATH,
|
||||||
settings=Settings(allow_reset=True, anonymized_telemetry=False),
|
settings=Settings(**settings_dict),
|
||||||
tenant=CHROMA_TENANT,
|
tenant=CHROMA_TENANT,
|
||||||
database=CHROMA_DATABASE,
|
database=CHROMA_DATABASE,
|
||||||
)
|
)
|
||||||
|
@ -937,6 +937,8 @@ CHROMA_TENANT = os.environ.get("CHROMA_TENANT", chromadb.DEFAULT_TENANT)
|
|||||||
CHROMA_DATABASE = os.environ.get("CHROMA_DATABASE", chromadb.DEFAULT_DATABASE)
|
CHROMA_DATABASE = os.environ.get("CHROMA_DATABASE", chromadb.DEFAULT_DATABASE)
|
||||||
CHROMA_HTTP_HOST = os.environ.get("CHROMA_HTTP_HOST", "")
|
CHROMA_HTTP_HOST = os.environ.get("CHROMA_HTTP_HOST", "")
|
||||||
CHROMA_HTTP_PORT = int(os.environ.get("CHROMA_HTTP_PORT", "8000"))
|
CHROMA_HTTP_PORT = int(os.environ.get("CHROMA_HTTP_PORT", "8000"))
|
||||||
|
CHROMA_CLIENT_AUTH_PROVIDER = os.environ.get("CHROMA_CLIENT_AUTH_PROVIDER", "")
|
||||||
|
CHROMA_CLIENT_AUTH_CREDENTIALS = os.environ.get("CHROMA_CLIENT_AUTH_CREDENTIALS", "")
|
||||||
# Comma-separated list of header=value pairs
|
# Comma-separated list of header=value pairs
|
||||||
CHROMA_HTTP_HEADERS = os.environ.get("CHROMA_HTTP_HEADERS", "")
|
CHROMA_HTTP_HEADERS = os.environ.get("CHROMA_HTTP_HEADERS", "")
|
||||||
if CHROMA_HTTP_HEADERS:
|
if CHROMA_HTTP_HEADERS:
|
||||||
|
@ -40,7 +40,7 @@ langchain-community==0.2.12
|
|||||||
langchain-chroma==0.1.4
|
langchain-chroma==0.1.4
|
||||||
|
|
||||||
fake-useragent==1.5.1
|
fake-useragent==1.5.1
|
||||||
chromadb==0.5.9
|
chromadb==0.5.15
|
||||||
pymilvus==2.4.7
|
pymilvus==2.4.7
|
||||||
qdrant-client~=1.12.0
|
qdrant-client~=1.12.0
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user