From 3f97a7a090013564b3a6f92d6be3a2aea575eaaa Mon Sep 17 00:00:00 2001 From: wizardchen Date: Tue, 21 Apr 2026 14:46:41 +0800 Subject: [PATCH] feat: Add locked indexing strategy warning and UI enhancements in KnowledgeBaseEditorModal - Introduced a new warning message in English and Chinese to inform users that the indexing strategy cannot be changed once the knowledge base contains content. - Updated the UI to visually indicate when indexing options are locked, preventing user interaction with disabled checkboxes. - Enhanced the styling of the indexing strategy section to improve user experience and clarity. These changes ensure users are aware of the restrictions on indexing strategy modifications, enhancing the overall usability of the knowledge base editor. --- frontend/src/i18n/locales/en-US.ts | 1 + frontend/src/i18n/locales/zh-CN.ts | 1 + .../knowledge/KnowledgeBaseEditorModal.vue | 40 +++++++++++++++++-- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts index b781eeb9..13b87ad4 100755 --- a/frontend/src/i18n/locales/en-US.ts +++ b/frontend/src/i18n/locales/en-US.ts @@ -1627,6 +1627,7 @@ export default { atLeastOne: 'At least one indexing strategy must be enabled', embeddingRequired: 'RAG search requires an Embedding model', wikiModelRequired: 'Wiki requires a synthesis model to be configured', + lockedTip: 'The indexing strategy cannot be changed once the knowledge base contains content. Please clear the knowledge base first.', rebuildConfirmTitle: 'Rebuild Index', rebuildConfirmBody: 'Indexing strategy has changed. Re-process {count} existing documents? This may take some time.', rebuildSuccess: 'Rebuild task submitted for {count} documents', diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts index dd3151c6..040a7de2 100755 --- a/frontend/src/i18n/locales/zh-CN.ts +++ b/frontend/src/i18n/locales/zh-CN.ts @@ -2152,6 +2152,7 @@ export default { atLeastOne: "至少需要开启一种索引策略", embeddingRequired: "RAG 检索需要配置 Embedding 模型", wikiModelRequired: "Wiki 知识库需要配置合成模型", + lockedTip: "知识库已有内容,索引策略暂不支持调整。如需变更,请先清空知识库。", rebuildConfirmTitle: "重建索引", rebuildConfirmBody: "索引策略已变更,是否对已有的 {count} 篇文档重新处理?这可能需要一些时间。", rebuildSuccess: "已提交重建任务,共 {count} 篇文档", diff --git a/frontend/src/views/knowledge/KnowledgeBaseEditorModal.vue b/frontend/src/views/knowledge/KnowledgeBaseEditorModal.vue index 3b1f8fa5..0619dce4 100644 --- a/frontend/src/views/knowledge/KnowledgeBaseEditorModal.vue +++ b/frontend/src/views/knowledge/KnowledgeBaseEditorModal.vue @@ -57,25 +57,27 @@

{{ $t('knowledgeEditor.indexing.description') }}

-
+
{{ $t('knowledgeEditor.indexing.searchTitle') }}

{{ $t('knowledgeEditor.indexing.searchDesc') }}

@@ -86,6 +88,9 @@

{{ $t('knowledgeEditor.indexing.wikiDesc') }}

+

+ {{ $t('knowledgeEditor.indexing.lockedTip') }} +

@@ -601,13 +606,22 @@ const handleModelConfigUpdate = (config: any) => { } } +const isIndexingLocked = computed(() => props.mode === 'edit' && hasFiles.value) + const toggleVectorIndexing = () => { if (!formData.value) return + if (isIndexingLocked.value) return const next = !formData.value.indexingStrategy.vectorEnabled formData.value.indexingStrategy.vectorEnabled = next formData.value.indexingStrategy.keywordEnabled = next } +const toggleWikiIndexing = () => { + if (!formData.value) return + if (isIndexingLocked.value) return + formData.value.indexingStrategy.wikiEnabled = !formData.value.indexingStrategy.wikiEnabled +} + const handleChunkingConfigUpdate = (config: any) => { if (formData.value) { formData.value.chunkingConfig = { ...config } @@ -1292,12 +1306,30 @@ watch( background: var(--td-brand-color-light); } + &.is-disabled { + cursor: not-allowed; + opacity: 0.7; + + &:hover { + border-color: var(--td-component-stroke); + } + + &.is-checked:hover { + border-color: var(--td-brand-color); + } + } + :deep(.t-checkbox__label) { font-weight: 500; color: var(--td-text-color-primary); } } +.locked-tip { + color: var(--td-warning-color); + margin-top: 8px; +} + // 禁用内部 checkbox 自身的点击事件,统一由卡片处理 .indexing-check-box { pointer-events: none;