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) => { const deleteFile = (fileId) => {
console.log(fileId) console.log(fileId)
state.lock = true //
fetch('/api/data/document', { Modal.confirm({
method: "DELETE", title: '删除文件',
headers: { content: '确定要删除该文件吗?',
"Content-Type": "application/json" // Content-Type 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({ onCancel: () => {
db_id: databaseId.value, console.log('Cancel');
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)
})
} }
const chunkParams = ref({ const chunkParams = ref({
chunk_size: 1000, chunk_size: 1000,
chunk_overlap: 200, chunk_overlap: 200,

View File

@ -9,7 +9,7 @@
</template> </template>
</HeaderComponent> </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> <h3>数据库名称<span style="color: var(--error-color)">*</span></h3>
<a-input v-model:value="newDatabase.name" placeholder="新建数据库名称" /> <a-input v-model:value="newDatabase.name" placeholder="新建数据库名称" />
<h3 style="margin-top: 20px;">数据库描述</h3> <h3 style="margin-top: 20px;">数据库描述</h3>