diff --git a/frontend/src/views/knowledge/KnowledgeBase.vue b/frontend/src/views/knowledge/KnowledgeBase.vue index 17aaa3914..b6ff33e8c 100644 --- a/frontend/src/views/knowledge/KnowledgeBase.vue +++ b/frontend/src/views/knowledge/KnowledgeBase.vue @@ -1922,6 +1922,7 @@ const handleBatchTag = () => { }; const onBatchTagConfirm = async (tagIds: string[]) => { + if (batchTagging.value || selectedIds.value.size === 0) return; const ids = Array.from(selectedIds.value); const updateMap: Record = {}; for (const id of ids) { @@ -1931,8 +1932,10 @@ const onBatchTagConfirm = async (tagIds: string[]) => { try { await updateKnowledgeTagBatch({ updates: updateMap }); MessagePlugin.success(t('knowledgeBase.batchTagSuccess', { count: ids.length })); + batchTagDialogVisible.value = false; clearSelection(); batchMode.value = false; + resetPage(); loadKnowledgeFiles(kbId.value); loadTags(kbId.value, true); } catch (e: any) { @@ -2427,6 +2430,7 @@ async function createNewSession(value: string): Promise { diff --git a/frontend/src/views/knowledge/components/BatchTagDialog.test.ts b/frontend/src/views/knowledge/components/BatchTagDialog.test.ts new file mode 100644 index 000000000..2cecdf201 --- /dev/null +++ b/frontend/src/views/knowledge/components/BatchTagDialog.test.ts @@ -0,0 +1,42 @@ +import assert from 'node:assert/strict' +import test from 'node:test' +import { readFileSync } from 'node:fs' + +const component = readFileSync(new URL('./BatchTagDialog.vue', import.meta.url), 'utf8') +const zhCN = readFileSync(new URL('../../../i18n/locales/zh-CN.ts', import.meta.url), 'utf8') +const enUS = readFileSync(new URL('../../../i18n/locales/en-US.ts', import.meta.url), 'utf8') +const koKR = readFileSync(new URL('../../../i18n/locales/ko-KR.ts', import.meta.url), 'utf8') +const ruRU = readFileSync(new URL('../../../i18n/locales/ru-RU.ts', import.meta.url), 'utf8') + +test('uses a compact flat dialog with selected and available sections', () => { + assert.match(component, /dialog-class-name="batch-tag-dialog"/) + assert.match(component, /width="420px"/) + assert.match(component, /