fix(milvus): list all databases and their collections in sidebar
Milvus supports multiple databases, but the sidebar only ever showed collections under the hardcoded "default" database. The backend returned ["default"] for every vector store and the frontend loaded collections for a single database and flattened them under the connection node. - Backend (vector_driver): add list_databases() that calls Milvus /v2/vectordb/databases/list (falling back to "default" for older Milvus and for non-Milvus vector stores), and thread a database parameter through find_documents() instead of hardcoding "default". - document_ops: list_databases_core delegates VectorDb to list_databases(); find_documents_core forwards the selected database. - Frontend: add a "vector-database" tree node type. For Milvus, connections expand into database nodes, which expand into their own collections. Collection node ids are namespaced by database to avoid collisions across databases, and the collection id is stored in meta so activation no longer parses the node id. Fixes #2693 Co-authored-by: 朱豪豪 <zhu.hh.sz@belle.com.cn>
This commit is contained in:
1 parent
b6b510d632
commit
95b7b8b9a3
10 files changed
+112
-23
No files matched your search
@@ -230,7 +230,9 @@ function increaseTableFontSize() {
|
||||
const activeTabDimension = computed(() => {
|
||||
const tab = props.activeTab;
|
||||
if (!tab.connectionId || tab.mode !== "vector") return undefined;
|
||||
const nodeId = `${tab.connectionId}:__vector_collection:${tab.sql}`;
|
||||
const isMilvus = connectionStore.getConfig(tab.connectionId)?.db_type === "milvus";
|
||||
const suffix = isMilvus && tab.database ? `${tab.database}:${tab.sql}` : tab.sql;
|
||||
const nodeId = `${tab.connectionId}:__vector_collection:${suffix}`;
|
||||
const meta = findNodeInTree(connectionStore.treeNodes, nodeId)?.meta;
|
||||
return meta && "dimension" in meta ? (meta as VectorCollectionMeta).dimension : undefined;
|
||||
});
|
||||
|
||||
@@ -580,7 +580,9 @@ async function toggle() {
|
||||
await connectionStore.loadMongoDatabases(node.connectionId);
|
||||
} else if (config?.db_type === "elasticsearch") {
|
||||
await connectionStore.loadElasticsearchIndices(node.connectionId);
|
||||
} else if (config?.db_type === "qdrant" || config?.db_type === "milvus" || config?.db_type === "weaviate" || config?.db_type === "chromadb") {
|
||||
} else if (config?.db_type === "milvus") {
|
||||
await connectionStore.loadMilvusDatabases(node.connectionId);
|
||||
} else if (config?.db_type === "qdrant" || config?.db_type === "weaviate" || config?.db_type === "chromadb") {
|
||||
await connectionStore.loadVectorCollections(node.connectionId);
|
||||
} else if (config?.db_type === "mq") {
|
||||
await connectionStore.loadMqTenants(node.connectionId);
|
||||
@@ -614,6 +616,8 @@ async function toggle() {
|
||||
queryStore.openUserAdmin(node.connectionId);
|
||||
} else if (node.type === "mongo-db" && node.connectionId && node.database) {
|
||||
await connectionStore.loadMongoCollections(node.connectionId, node.database);
|
||||
} else if (node.type === "vector-database" && node.connectionId && node.database) {
|
||||
await connectionStore.loadVectorCollections(node.connectionId, node.database);
|
||||
} else if (node.type === "mongo-collection" && node.connectionId && node.database) {
|
||||
await connectionStore.loadTableGroups(node.connectionId, node.database, node.label, node.schema, node.id);
|
||||
} else if (node.type === "elasticsearch-index" && node.connectionId) {
|
||||
@@ -622,7 +626,7 @@ async function toggle() {
|
||||
queryStore.updateSql(tab, node.label);
|
||||
} else if (node.type === "vector-collection" && node.connectionId) {
|
||||
await connectionStore.ensureConnected(node.connectionId);
|
||||
const collectionRef = node.id.includes("__vector_collection:") ? node.id.split("__vector_collection:").pop() || node.label : node.label;
|
||||
const collectionRef = (node.meta as { collectionId?: string } | undefined)?.collectionId ?? node.label;
|
||||
const tab = queryStore.createTab(node.connectionId, node.database || "default", node.label, "vector");
|
||||
queryStore.updateSql(tab, collectionRef);
|
||||
api
|
||||
|
||||
Reference in new issue
Block a user