style(frontend): polish knowledge base settings hints and sub-sections (#4193)

- Replace heavy warning alerts for locked states (embedding model, indexing
  strategy, storage engine) with subtle lock-icon hints
- Redesign the AI-generated description card with empty state and footer actions
- Replace the graph-database-disabled alert with an inline empty-state card
- Drop thick left-border panels in advanced and chunking settings in favor of
  rounded secondary containers; widen descriptions for switch rows
main
lyingbug 2026-10-12 18:04:35 +08:00 committed by GitHub
parent ef54e835c9
commit 8fae51c640
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 314 additions and 121 deletions

View File

@ -75,8 +75,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 v-if="isIndexingLocked" class="locked-tip">
<t-icon name="lock-on" class="locked-tip-icon" />
<span>{{ $t('knowledgeEditor.indexing.lockedTip') }}</span>
</p>
</div>
@ -142,60 +143,83 @@
/>
</div>
<!-- AI 生成的知识库描述(仅编辑模式、文档型知识库) -->
<div v-if="editorMode === 'edit' && !isFAQ" class="form-item">
<label class="form-label">{{ $t('knowledgeEditor.basic.profile.title') }}</label>
<p class="form-tip">{{ $t('knowledgeEditor.basic.profile.hint') }}</p>
<div class="kb-profile-card">
<template v-if="generatedProfileHasText">
<p v-if="generatedProfile?.gist" class="kb-profile-gist">{{ generatedProfile.gist }}</p>
<div v-if="generatedProfile?.topics?.length" class="kb-profile-topics">
<t-tag
v-for="topic in generatedProfile.topics"
:key="topic"
size="small"
variant="light"
>{{ topic }}</t-tag>
</div>
<div v-if="generatedProfile?.typical_questions?.length" class="kb-profile-questions">
<p class="kb-profile-subtitle">{{ $t('knowledgeEditor.basic.profile.questions') }}</p>
<ul>
<li v-for="q in generatedProfile.typical_questions" :key="q">{{ q }}</li>
</ul>
</div>
</template>
<p v-else class="kb-profile-empty">
{{ generatedProfile?.status === 'empty'
? $t('knowledgeEditor.basic.profile.noDocuments')
: $t('knowledgeEditor.basic.profile.empty') }}
</p>
<p v-if="generatedProfile?.status === 'failed'" class="kb-profile-error">
{{ $t('knowledgeEditor.basic.profile.failed', { error: generatedProfile.error || '' }) }}
</p>
<p v-if="generatedProfileMeta" class="kb-profile-meta">{{ generatedProfileMeta }}</p>
<div class="kb-profile-actions">
<t-button
size="small"
theme="primary"
variant="outline"
:loading="generatingProfile"
@click="handleGenerateProfile"
>
{{ generatedProfileHasText
? $t('knowledgeEditor.basic.profile.regenerate')
: $t('knowledgeEditor.basic.profile.generate') }}
</t-button>
<t-button
v-if="generatedProfile?.gist"
size="small"
variant="text"
@click="handleAdoptProfileGist"
>
{{ $t('knowledgeEditor.basic.profile.adopt') }}
</t-button>
</div>
</div>
</div>
<!-- AI 生成的知识库描述(仅编辑模式、文档型知识库) -->
<div v-if="editorMode === 'edit' && !isFAQ" class="form-item">
<label class="form-label">{{ $t('knowledgeEditor.basic.profile.title') }}</label>
<div class="kb-profile-card" :class="{ 'is-empty': !generatedProfileHasText }">
<template v-if="generatedProfileHasText">
<p v-if="generatedProfile?.gist" class="kb-profile-gist">{{ generatedProfile.gist }}</p>
<div v-if="generatedProfile?.topics?.length" class="kb-profile-topics">
<t-tag
v-for="topic in generatedProfile.topics"
:key="topic"
size="small"
theme="primary"
variant="light"
>{{ topic }}</t-tag>
</div>
<div v-if="generatedProfile?.typical_questions?.length" class="kb-profile-questions">
<p class="kb-profile-subtitle">{{ $t('knowledgeEditor.basic.profile.questions') }}</p>
<ul>
<li v-for="q in generatedProfile.typical_questions" :key="q">{{ q }}</li>
</ul>
</div>
<p v-if="generatedProfile?.status === 'failed'" class="kb-profile-error">
{{ $t('knowledgeEditor.basic.profile.failed', { error: generatedProfile.error || '' }) }}
</p>
<div class="kb-profile-footer">
<span class="kb-profile-meta">{{ generatedProfileMeta }}</span>
<div class="kb-profile-actions">
<t-button
v-if="generatedProfile?.gist"
size="small"
variant="text"
theme="primary"
@click="handleAdoptProfileGist"
>
<template #icon><t-icon name="enter" /></template>
{{ $t('knowledgeEditor.basic.profile.adopt') }}
</t-button>
<t-button
size="small"
variant="text"
:loading="generatingProfile"
@click="handleGenerateProfile"
>
<template #icon><t-icon name="refresh" /></template>
{{ $t('knowledgeEditor.basic.profile.regenerate') }}
</t-button>
</div>
</div>
</template>
<template v-else>
<div class="kb-profile-empty">
<span class="kb-profile-empty-icon"><t-icon name="ai-edit-1" /></span>
<div class="kb-profile-empty-text">
<p>
{{ generatedProfile?.status === 'empty'
? $t('knowledgeEditor.basic.profile.noDocuments')
: $t('knowledgeEditor.basic.profile.empty') }}
</p>
<p v-if="generatedProfile?.status === 'failed'" class="kb-profile-error">
{{ $t('knowledgeEditor.basic.profile.failed', { error: generatedProfile.error || '' }) }}
</p>
</div>
<t-button
size="small"
theme="primary"
variant="outline"
:loading="generatingProfile"
@click="handleGenerateProfile"
>
<template #icon><t-icon name="ai-edit-1" /></template>
{{ $t('knowledgeEditor.basic.profile.generate') }}
</t-button>
</div>
</template>
</div>
<p class="form-tip">{{ $t('knowledgeEditor.basic.profile.hint') }}</p>
</div>
<!-- Wiki 合成模型移至模型配置页 -->
</div>
@ -2133,14 +2157,19 @@ watch(() => chatResources.allModels, (list) => {
&.is-disabled {
cursor: not-allowed;
opacity: 0.7;
background: var(--td-bg-color-secondarycontainer);
&:hover {
border-color: var(--td-component-stroke);
}
&.is-checked:hover {
border-color: var(--td-brand-color);
&.is-checked {
border-color: var(--td-brand-color-focus);
background: var(--td-brand-color-light);
}
&:not(.is-checked) {
opacity: 0.6;
}
}
@ -2151,8 +2180,20 @@ watch(() => chatResources.allModels, (list) => {
}
.locked-tip {
color: var(--td-warning-color);
margin-top: 8px;
display: flex;
align-items: flex-start;
gap: 6px;
margin: 8px 0 0;
font-size: var(--app-text-sm);
line-height: 18px;
color: var(--td-text-color-secondary);
.locked-tip-icon {
flex-shrink: 0;
margin-top: 2px;
font-size: var(--app-text-base);
color: var(--td-text-color-placeholder);
}
}
// 禁用内部 checkbox 自身的点击事件,统一由卡片处理
@ -2291,14 +2332,19 @@ watch(() => chatResources.allModels, (list) => {
}
.kb-profile-card {
margin-top: 8px;
padding: 12px 14px;
padding: 12px 14px 8px;
border: 1px solid var(--td-component-stroke);
border-radius: var(--app-radius-md);
background: var(--td-bg-color-secondarycontainer);
background: var(--td-bg-color-container);
&.is-empty {
padding: 12px 14px;
border-style: dashed;
background: var(--td-bg-color-secondarycontainer);
}
.kb-profile-gist {
margin: 0 0 8px;
margin: 0 0 10px;
font-size: var(--app-text-base);
line-height: 1.6;
color: var(--td-text-color-primary);
@ -2308,45 +2354,85 @@ watch(() => chatResources.allModels, (list) => {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin-bottom: 8px;
margin-bottom: 10px;
}
.kb-profile-subtitle {
margin: 0 0 4px;
font-size: var(--app-text-sm);
font-weight: 500;
color: var(--td-text-color-secondary);
}
.kb-profile-questions ul {
margin: 0 0 8px;
margin: 0 0 4px;
padding-left: 18px;
font-size: var(--app-text-md);
line-height: 1.6;
color: var(--td-text-color-primary);
}
.kb-profile-empty {
margin: 0 0 8px;
font-size: var(--app-text-md);
color: var(--td-text-color-placeholder);
line-height: 1.7;
color: var(--td-text-color-secondary);
}
.kb-profile-error {
margin: 0 0 8px;
margin: 4px 0 0;
font-size: var(--app-text-sm);
color: var(--td-error-color);
}
.kb-profile-footer {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-top: 8px;
padding-top: 8px;
border-top: 1px solid var(--td-component-stroke);
}
.kb-profile-meta {
margin: 0 0 8px;
min-width: 0;
font-size: var(--app-text-sm);
color: var(--td-text-color-placeholder);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.kb-profile-actions {
display: flex;
gap: 8px;
flex-shrink: 0;
gap: 4px;
align-items: center;
}
.kb-profile-empty {
display: flex;
align-items: center;
gap: 12px;
}
.kb-profile-empty-icon {
display: inline-flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
border-radius: var(--app-radius-md);
font-size: var(--app-text-2xl);
color: var(--td-brand-color);
background: var(--td-brand-color-light);
}
.kb-profile-empty-text {
flex: 1;
min-width: 0;
p {
margin: 0;
font-size: var(--app-text-md);
line-height: 1.5;
color: var(--td-text-color-secondary);
}
}
}
</style>

View File

@ -3,29 +3,23 @@
<div v-if="!embedded" class="section-header">
<h2>{{ t('graphSettings.title') }}</h2>
<p class="section-description">{{ t('graphSettings.description') }}</p>
<t-alert
v-if="!isGraphDatabaseEnabled"
theme="warning"
style="margin-top: 16px;"
>
<template #message>
<div>{{ t('graphSettings.disabledWarning') }}</div>
<t-link class="graph-guide-link" theme="primary" @click="handleOpenGraphGuide">
{{ t('graphSettings.howToEnable') }}
</t-link>
</template>
</t-alert>
</div>
<t-alert
v-else-if="!isGraphDatabaseEnabled"
theme="warning"
class="embedded-graph-alert"
>
<template #message>
<div>{{ t('graphSettings.disabledWarning') }}</div>
</template>
</t-alert>
<div v-if="!isGraphDatabaseEnabled" class="graph-disabled">
<span class="graph-disabled-icon"><t-icon name="chart-bubble" /></span>
<div class="graph-disabled-text">
<p>{{ t('graphSettings.disabledWarning') }}</p>
</div>
<t-button
v-if="!embedded"
size="small"
theme="primary"
variant="outline"
@click="handleOpenGraphGuide"
>
<template #icon><t-icon name="help-circle" /></template>
{{ t('graphSettings.howToEnable') }}
</t-button>
</div>
<div v-if="isGraphDatabaseEnabled" class="settings-group">
<!-- 启用实体关系提取 -->
@ -624,6 +618,41 @@ onMounted(async () => {
}
}
.graph-disabled {
display: flex;
align-items: center;
gap: 12px;
padding: 12px 14px;
border: 1px dashed var(--td-component-stroke);
border-radius: var(--app-radius-md);
background: var(--td-bg-color-secondarycontainer);
}
.graph-disabled-icon {
display: inline-flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
border-radius: var(--app-radius-md);
font-size: var(--app-text-2xl);
color: var(--td-warning-color);
background: var(--td-warning-color-light);
}
.graph-disabled-text {
flex: 1;
min-width: 0;
p {
margin: 0;
font-size: var(--app-text-md);
line-height: 1.5;
color: var(--td-text-color-secondary);
}
}
.settings-group {
display: flex;
flex-direction: column;
@ -798,7 +827,7 @@ onMounted(async () => {
}
.graph-settings--embedded {
.embedded-graph-alert {
.graph-disabled {
margin-bottom: 12px;
}

View File

@ -368,13 +368,45 @@ const handleQuestionGenerationChange = () => {
}
}
.subsection {
padding: 16px 20px;
margin: 12px 0 0 0;
background: var(--td-bg-color-container);
border-radius: var(--app-radius-md);
border-left: 3px solid var(--td-brand-color);
position: relative;
.kb-advanced-settings:not(.kb-advanced-settings--embedded) {
.setting-row:has(> .setting-control > .t-switch) {
align-items: center;
.setting-info {
flex: 1;
max-width: none;
}
.setting-control {
flex: none;
max-width: none;
}
}
.setting-row:has(+ .subsection) {
border-bottom: none;
padding-bottom: 12px;
}
.subsection {
margin-bottom: 4px;
padding: 0 16px;
background: var(--td-bg-color-secondarycontainer);
border-radius: var(--app-radius-md);
.setting-row {
padding: 14px 0;
}
.setting-row-vertical {
gap: 8px;
}
}
.subsection + .setting-row {
margin-top: 12px;
border-top: 1px solid var(--td-component-stroke);
}
}
.required {

View File

@ -32,6 +32,7 @@
<!-- Strategy explanation panel -->
<div v-if="currentStrategyInfo" class="strategy-info-panel">
<t-icon name="info-circle" class="strategy-info-icon" />
<p>
<strong>{{ currentStrategyInfo.label }}:</strong>
{{ currentStrategyInfo.tooltip }}
@ -460,15 +461,26 @@ const emitUpdate = () => {
.strategy-info-panel {
margin: 0 0 16px 0;
display: flex;
align-items: flex-start;
gap: 8px;
padding: 10px 14px;
background: var(--td-bg-color-container-hover);
border-left: 3px solid var(--td-brand-color);
border-radius: 0 4px 4px 0;
background: var(--td-bg-color-secondarycontainer);
border-radius: var(--app-radius-md);
font-size: var(--app-text-md);
color: var(--td-text-color-secondary);
line-height: 1.5;
.strategy-info-icon {
flex-shrink: 0;
margin-top: 3px;
font-size: var(--app-text-base);
color: var(--td-brand-color);
}
p {
flex: 1;
min-width: 0;
margin: 0;
word-break: break-word;
}

View File

@ -38,14 +38,8 @@
? $t('knowledgeEditor.models.embeddingWikiOptionalDesc')
: $t('knowledgeEditor.models.embeddingDesc') }}
</p>
<t-alert
v-if="ragEnabled && hasFiles"
theme="warning"
:message="$t('knowledgeEditor.models.embeddingLocked')"
style="margin-top: 8px;"
/>
</div>
<div class="setting-control">
<div class="setting-control setting-control--stacked">
<ModelSelector
ref="embeddingSelectorRef"
model-type="Embedding"
@ -57,6 +51,10 @@
@add-model="handleAddModel('embedding')"
:placeholder="$t('knowledgeEditor.models.embeddingPlaceholder')"
/>
<p v-if="ragEnabled && hasFiles" class="locked-hint">
<t-icon name="lock-on" class="locked-hint-icon" />
<span>{{ $t('knowledgeEditor.models.embeddingLocked') }}</span>
</p>
</div>
</div>
@ -222,6 +220,29 @@ const handleAddModel = (subSection: string) => {
display: flex;
justify-content: flex-end;
align-items: flex-start;
&--stacked {
flex-direction: column;
align-items: stretch;
gap: 6px;
}
}
.locked-hint {
display: flex;
align-items: flex-start;
gap: 6px;
margin: 0;
font-size: var(--app-text-sm);
line-height: 18px;
color: var(--td-text-color-secondary);
.locked-hint-icon {
flex-shrink: 0;
margin-top: 2px;
font-size: var(--app-text-base);
color: var(--td-text-color-placeholder);
}
}
</style>

View File

@ -21,7 +21,10 @@
</span>
</t-option>
</t-select>
<p v-if="props.hasFiles" class="option-hint change-warning">{{ $t('kbSettings.storage.migrateHint') }}</p>
<p v-if="props.hasFiles" class="option-hint locked-hint">
<t-icon name="lock-on" class="locked-hint-icon" />
<span>{{ $t('kbSettings.storage.migrateHint') }}</span>
</p>
<p v-else-if="selected" class="option-hint">{{ selected.config.endpoint || selected.config.bucket_name || selected.config.path_prefix || $t('kbSettings.storage.localStorage') }}</p>
<a href="javascript:void(0)" class="go-settings" @click.prevent="goToSettings">{{ $t('kbSettings.storage.manageInstances') }}</a>
</div>
@ -65,5 +68,5 @@ onMounted(load)
<style scoped lang="less">
.section-header{margin-bottom:20px}.section-header h2{font-size:var(--app-text-3xl);margin:0 0 6px}.section-description,.desc,.option-hint{color:var(--td-text-color-secondary)}
.setting-row{display:flex;justify-content:space-between;gap:28px}.setting-info{flex:1}.setting-control{width:45%;min-width:300px}.select-option{display:flex;align-items:center;gap:8px}.option-hint{font-size:var(--app-text-sm);margin:8px 0}.change-warning{color:var(--td-warning-color)}.go-settings{font-size:var(--app-text-md);color:var(--td-brand-color)}.loading-inline{display:flex;gap:8px}
.setting-row{display:flex;justify-content:space-between;gap:28px}.setting-info{flex:1}.setting-control{width:45%;min-width:300px}.select-option{display:flex;align-items:center;gap:8px}.option-hint{font-size:var(--app-text-sm);margin:8px 0}.locked-hint{display:flex;align-items:flex-start;gap:6px;line-height:18px}.locked-hint-icon{flex-shrink:0;margin-top:2px;font-size:var(--app-text-base);color:var(--td-text-color-placeholder)}.go-settings{font-size:var(--app-text-md);color:var(--td-brand-color)}.loading-inline{display:flex;gap:8px}
</style>

View File

@ -83,7 +83,8 @@
v-if="props.boundStatus === 'unavailable'"
class="option-hint change-warning"
>
{{ $t('kbSettings.vectorStore.unavailableHint') }}
<t-icon name="error-circle" class="option-hint-icon" />
<span>{{ $t('kbSettings.vectorStore.unavailableHint') }}</span>
</p>
</div>
</div>
@ -269,8 +270,17 @@ onMounted(async () => {
line-height: 1.4;
&.change-warning {
display: flex;
align-items: flex-start;
gap: 6px;
color: var(--td-warning-color);
}
.option-hint-icon {
flex-shrink: 0;
margin-top: 1px;
font-size: var(--app-text-base);
}
}
.go-settings {