dify知识库同步/删除问题修复
This commit is contained in:
1 parent
4ff07f8f9b
commit
c14046f9f3
8 files changed
+89
-44
No files matched your search
@@ -102,9 +102,11 @@ const openDeleteConfirmDialog = (
|
||||
message: string,
|
||||
onConfirm: () => Promise<void> | void
|
||||
) => {
|
||||
console.log('[KB] openDeleteConfirmDialog', message);
|
||||
deleteConfirmMessage.value = message;
|
||||
pendingDeleteAction = onConfirm;
|
||||
showDeleteConfirmDialog.value = true;
|
||||
console.log('[KB] showDeleteConfirmDialog set to', showDeleteConfirmDialog.value);
|
||||
};
|
||||
|
||||
const closeDeleteConfirmDialog = () => {
|
||||
@@ -115,7 +117,13 @@ const closeDeleteConfirmDialog = () => {
|
||||
|
||||
const handleDeleteConfirm = async () => {
|
||||
if (!pendingDeleteAction) return;
|
||||
await pendingDeleteAction();
|
||||
try {
|
||||
await pendingDeleteAction();
|
||||
} catch (err) {
|
||||
console.error('[deleteConfirm]', err);
|
||||
feedback.value = String(err) || '操作失败';
|
||||
feedbackType.value = 'error';
|
||||
}
|
||||
closeDeleteConfirmDialog();
|
||||
};
|
||||
const selectedDocument = computed(() => documents.value.find((item) => item.id === selectedDocumentId.value) || null);
|
||||
@@ -1110,6 +1118,7 @@ const toggleSelectAllFiltered = () => {
|
||||
};
|
||||
|
||||
const handleDeleteDocument = async (doc: KbDocumentItem) => {
|
||||
console.log('[KB] handleDeleteDocument called', doc.id, doc.title);
|
||||
openDeleteConfirmDialog(`确认删除文档「${getDocumentDisplayTitle(doc)}」吗?`, async () => {
|
||||
const result = await deleteKbDocument(doc.id);
|
||||
if (!result.ok) {
|
||||
@@ -1161,6 +1170,7 @@ const handleBatchSync = async () => {
|
||||
};
|
||||
|
||||
const handleBatchDelete = async () => {
|
||||
console.log('[KB] handleBatchDelete called, selected:', selectedDocuments.value.length);
|
||||
if (!selectedDocuments.value.length) {
|
||||
feedback.value = '请先选择要批量删除的文档';
|
||||
feedbackType.value = 'error';
|
||||
@@ -2581,11 +2591,12 @@ onUnmounted(() => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<DeleteConfirmDialog
|
||||
v-model="showDeleteConfirmDialog"
|
||||
:message="deleteConfirmMessage"
|
||||
@confirm="handleDeleteConfirm"
|
||||
@cancel="closeDeleteConfirmDialog"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<DeleteConfirmDialog
|
||||
v-model="showDeleteConfirmDialog"
|
||||
:message="deleteConfirmMessage"
|
||||
@confirm="handleDeleteConfirm"
|
||||
@cancel="closeDeleteConfirmDialog"
|
||||
/>
|
||||
</template>
|
||||
Reference in new issue
Block a user