修复数据库删除后,文件夹没有删除的 bug
This commit is contained in:
parent
7563c116fc
commit
2864acd029
@ -2,6 +2,7 @@ import os
|
|||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
|
import shutil
|
||||||
|
|
||||||
from pymilvus import MilvusClient, MilvusException
|
from pymilvus import MilvusClient, MilvusException
|
||||||
|
|
||||||
@ -259,6 +260,10 @@ class KnowledgeBase:
|
|||||||
|
|
||||||
self.client.drop_collection(collection_name=db.db_id)
|
self.client.drop_collection(collection_name=db.db_id)
|
||||||
self.data.remove(db)
|
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()
|
self._save_databases()
|
||||||
return {"message": "删除成功"}
|
return {"message": "删除成功"}
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
</a-button>
|
</a-button>
|
||||||
</template>
|
</template>
|
||||||
</HeaderComponent>
|
</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">
|
<div class="db-main-container">
|
||||||
<a-tabs v-model:activeKey="state.curPage" class="atab-container" type="card">
|
<a-tabs v-model:activeKey="state.curPage" class="atab-container" type="card">
|
||||||
|
|
||||||
|
|||||||
@ -365,7 +365,7 @@ const graphStatusText = computed(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const graphDescription = computed(() => {
|
const graphDescription = computed(() => {
|
||||||
const dbName = graphInfo.value?.database_name || '';
|
const dbName = graphInfo.value?.graph_name || '';
|
||||||
const entityCount = graphInfo.value?.entity_count || 0;
|
const entityCount = graphInfo.value?.entity_count || 0;
|
||||||
const relationCount = graphInfo.value?.relationship_count || 0;
|
const relationCount = graphInfo.value?.relationship_count || 0;
|
||||||
const modelName = graphInfo.value?.embed_model_name || '未上传文件';
|
const modelName = graphInfo.value?.embed_model_name || '未上传文件';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user