Merge pull request #115 from zhaoshibao/feat-113-114

This commit is contained in:
Wenjie Zhang 2025-03-31 19:22:09 +08:00 committed by GitHub
commit f5302c4c4b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 36 additions and 22 deletions

View File

@ -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,

View File

@ -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>