mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 03:18:23 -05:00
[GH-ISSUE #10827] Bug and fix for Milvus database settings not being reflected on Milvus #16043
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @pablocerdeira on GitHub (Feb 26, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/10827
Installation Method
Docker (using
docker-compose)Environment
Confirmation:
Expected Behavior:
When configuring
MILVUS_DB(e.g.,vanilla) in thedocker-compose.yml, collections should be created and managed in the specified database (vanilla) instead of the default database (default) when using Milvus as the vector database.Actual Behavior:
Collections are always created in the
defaultdatabase, even whenMILVUS_DBis set to a custom value (e.g.,vanilla). TheMilvusClientinitialization withdatabase=MILVUS_DBdoes not enforce the specified database, and tools like Attu and Milvus Web show all collections underdefault.Description
Bug Summary:
The
MilvusClientinopen_webui/retrieval/vector/dbs/milvus.pydoes not correctly use the database specified inMILVUS_DBfrom the configuration. Collections are created in thedefaultdatabase instead, due to an issue with howpymilvushandles thedatabaseparameter in theMilvusClientconstructor. This requires explicit use ofconnections.connectandusing_database()to enforce the configured database.Reproduction Details
Steps to Reproduce:
docker-compose.ymlthat includes Milvus integration:milvusdb/milvus:v2.5.4-gpu) using its owndocker-compose.yml.docker-compose up -d.open_webui_<id>) appear in thedefaultdatabase, notvanilla.Logs and Screenshots
Docker Container Logs:
From
vanilla-open-webui:MILVUS_DB=vanilla, these collections appear indefaultin Attu and Milvus Web.Additional Information
pymilvus(v2.5.4)MilvusClientconstructor withdatabase=MILVUS_DBdoes not reliably set the active database. Explicitly usingconnections.connectfollowed byusing_database(MILVUS_DB)resolves this by ensuring the database context is correctly applied before operations.milvus.pyto useconnections.connectandusing_database()ensures collections are created in the configured database (e.g.,vanilla).pymilvus==2.5.4andmilvusdb/milvus:v2.5.4-gpu.Diff Patch:
Below is the minimal diff between the original
milvus.pyand the fixed version:Note: The diff above uses
self.client.using_database(MILVUS_DB)as a separate line for clarity in the diff. In practice, it should be called directly before the operation (e.g.,self.client.using_database(MILVUS_DB)followed byself.client.create_collection(...)on the next line).Note
This fix ensures compatibility with user-configured
MILVUS_URIandMILVUS_DB, addressing the issue without requiring changes to the Milvus server configuration. I recommend integrating this into the main codebase or documenting it as a workaround for users relying on custom databases with Milvus.@tjbck commented on GitHub (Feb 26, 2025):
PR welcome!