1、新增知识库文件删除提示功能,防止文件误删除;解决新建数据库弹窗右上角关闭按钮关闭不了问题。(关联 Issue #113 #114)
This commit is contained in:
parent
39b33c8f01
commit
152707a1b9
@ -558,30 +558,44 @@ const getDatabaseInfo = () => {
|
||||
|
||||
const deleteFile = (fileId) => {
|
||||
console.log(fileId)
|
||||
state.lock = true
|
||||
fetch('/api/data/document', {
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
"Content-Type": "application/json" // 添加 Content-Type 头
|
||||
//删除提示
|
||||
Modal.confirm({
|
||||
title: '删除文件',
|
||||
content: '确定要删除该文件吗?',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
state.lock = true
|
||||
fetch('/api/data/document', {
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
"Content-Type": "application/json" // 添加 Content-Type 头
|
||||
},
|
||||
body: JSON.stringify({
|
||||
db_id: databaseId.value,
|
||||
file_id: fileId
|
||||
}),
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log(data)
|
||||
message.success(data.message)
|
||||
getDatabaseInfo()
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error)
|
||||
message.error(error.message)
|
||||
})
|
||||
.finally(() => {
|
||||
state.lock = false
|
||||
})
|
||||
},
|
||||
body: JSON.stringify({
|
||||
db_id: databaseId.value,
|
||||
file_id: fileId
|
||||
}),
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log(data)
|
||||
message.success(data.message)
|
||||
getDatabaseInfo()
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error)
|
||||
message.error(error.message)
|
||||
})
|
||||
onCancel: () => {
|
||||
console.log('Cancel');
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
const chunkParams = ref({
|
||||
chunk_size: 1000,
|
||||
chunk_overlap: 200,
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
</template>
|
||||
</HeaderComponent>
|
||||
|
||||
<a-modal :open="newDatabase.open" title="新建数据库" @ok="createDatabase">
|
||||
<a-modal :open="newDatabase.open" title="新建数据库" @ok="createDatabase" @cancel="newDatabase.open=false">
|
||||
<h3>数据库名称<span style="color: var(--error-color)">*</span></h3>
|
||||
<a-input v-model:value="newDatabase.name" placeholder="新建数据库名称" />
|
||||
<h3 style="margin-top: 20px;">数据库描述</h3>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user