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.
This commit is contained in:
wizardchen
2026-04-21 14:46:41 +08:00
parent fdccb68ee4
commit 3f97a7a090
3 changed files with 38 additions and 4 deletions
+1
View File
@@ -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',
+1
View File
@@ -2152,6 +2152,7 @@ export default {
atLeastOne: "至少需要开启一种索引策略",
embeddingRequired: "RAG 检索需要配置 Embedding 模型",
wikiModelRequired: "Wiki 知识库需要配置合成模型",
lockedTip: "知识库已有内容,索引策略暂不支持调整。如需变更,请先清空知识库。",
rebuildConfirmTitle: "重建索引",
rebuildConfirmBody: "索引策略已变更,是否对已有的 {count} 篇文档重新处理?这可能需要一些时间。",
rebuildSuccess: "已提交重建任务,共 {count} 篇文档",
@@ -57,25 +57,27 @@
<div v-if="!isFAQ" class="form-item">
<label class="form-label required">{{ $t('knowledgeEditor.indexing.title') }}</label>
<p class="form-tip">{{ $t('knowledgeEditor.indexing.description') }}</p>
<div class="indexing-checks">
<div class="indexing-checks" :class="{ 'is-locked': isIndexingLocked }">
<div
class="indexing-check-item"
:class="{ 'is-checked': formData.indexingStrategy.vectorEnabled }"
:class="{ 'is-checked': formData.indexingStrategy.vectorEnabled, 'is-disabled': isIndexingLocked }"
@click="toggleVectorIndexing"
>
<t-checkbox
:checked="formData.indexingStrategy.vectorEnabled"
:disabled="isIndexingLocked"
class="indexing-check-box"
>{{ $t('knowledgeEditor.indexing.searchTitle') }}</t-checkbox>
<p class="indexing-check-desc">{{ $t('knowledgeEditor.indexing.searchDesc') }}</p>
</div>
<div
class="indexing-check-item"
:class="{ 'is-checked': formData.indexingStrategy.wikiEnabled }"
@click="formData.indexingStrategy.wikiEnabled = !formData.indexingStrategy.wikiEnabled"
:class="{ 'is-checked': formData.indexingStrategy.wikiEnabled, 'is-disabled': isIndexingLocked }"
@click="toggleWikiIndexing"
>
<t-checkbox
:checked="formData.indexingStrategy.wikiEnabled"
:disabled="isIndexingLocked"
class="indexing-check-box"
>
<span class="indexing-check-title">
@@ -86,6 +88,9 @@
<p class="indexing-check-desc">{{ $t('knowledgeEditor.indexing.wikiDesc') }}</p>
</div>
</div>
<p v-if="isIndexingLocked" class="form-tip locked-tip">
{{ $t('knowledgeEditor.indexing.lockedTip') }}
</p>
</div>
<div class="form-item">
@@ -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;