修复数据库删除后,文件夹没有删除的 bug

This commit is contained in:
Wenjie Zhang 2025-03-24 11:14:00 +08:00
parent 7563c116fc
commit 2864acd029
3 changed files with 7 additions and 2 deletions

View File

@ -2,6 +2,7 @@ import os
import json
import time
import traceback
import shutil
from pymilvus import MilvusClient, MilvusException
@ -259,6 +260,10 @@ class KnowledgeBase:
self.client.drop_collection(collection_name=db.db_id)
self.data.remove(db)
# 删除数据库对应的文件夹
db_folder = os.path.join(self.work_dir, db.db_id)
if os.path.exists(db_folder):
shutil.rmtree(db_folder)
self._save_databases()
return {"message": "删除成功"}

View File

@ -19,7 +19,7 @@
</a-button>
</template>
</HeaderComponent>
<a-alert v-if="database.embed_model != configStore.config.embed_model" message="向量模型不匹配,请重新选择" type="warning" style="margin: 10px 20px;" />
<a-alert v-if="configStore.config.embed_model &&database.embed_model != configStore.config.embed_model" message="向量模型不匹配,请重新选择" type="warning" style="margin: 10px 20px;" />
<div class="db-main-container">
<a-tabs v-model:activeKey="state.curPage" class="atab-container" type="card">

View File

@ -365,7 +365,7 @@ const graphStatusText = computed(() => {
});
const graphDescription = computed(() => {
const dbName = graphInfo.value?.database_name || '';
const dbName = graphInfo.value?.graph_name || '';
const entityCount = graphInfo.value?.entity_count || 0;
const relationCount = graphInfo.value?.relationship_count || 0;
const modelName = graphInfo.value?.embed_model_name || '未上传文件';