Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
feat(settings): refactor UI components for service and store management
wizardchend56f25c06284
diff --git a/frontend/src/views/settings/McpSettings.vue b/frontend/src/views/settings/McpSettings.vueindex 53ce920f8..6172a61c7 100644--- a/frontend/src/views/settings/McpSettings.vue+++ b/frontend/src/views/settings/McpSettings.vue@@ -12,15 +12,9 @@</div><template v-else>- <div class="settings-toolbar">- <div class="toolbar-info">- <h3>{{ $t('mcpSettings.configuredServices') }}</h3>- <p>{{ $t('mcpSettings.manageAndTest') }}</p>- </div>- <t-button v-if="authStore.hasRole('admin')" size="small" theme="primary" variant="outline" @click="handleAdd">- <template #icon><t-icon name="add" /></template>- {{ $t('mcpSettings.addService') }}- </t-button>+ <div class="list-section-header">+ <h3>{{ $t('mcpSettings.configuredServices') }}</h3>+ <p>{{ $t('mcpSettings.manageAndTest') }}</p></div><div v-if="services.length === 0" class="empty-state">@@ -103,6 +97,17 @@</div></div></div>+ <button+ v-if="authStore.hasRole('admin')"+ type="button"+ class="service-card service-card--add"+ @click="handleAdd"+ >+ <span class="service-card--add__icon" aria-hidden="true">+ <add-icon />+ </span>+ <span class="service-card--add__label">{{ $t('mcpSettings.addService') }}</span>+ </button></div></template>@@ -128,6 +133,7 @@<script setup lang="ts">import { ref, onMounted } from 'vue'import { MessagePlugin } from 'tdesign-vue-next'+import { AddIcon } from 'tdesign-icons-vue-next'import { useI18n } from 'vue-i18n'import {listMCPServices,@@ -355,30 +361,21 @@ onMounted(() => {text-align: center;}-.settings-toolbar {- display: flex;- align-items: flex-start;- justify-content: space-between;- gap: 12px;+.list-section-header {margin-bottom: 16px;- .toolbar-info {- flex: 1;- min-width: 0;-- h3 {- font-size: 15px;- font-weight: 500;- color: var(--td-text-color-primary);- margin: 0 0 4px 0;- }+ h3 {+ font-size: 16px;+ font-weight: 600;+ color: var(--td-text-color-primary);+ margin: 0 0 4px 0;+ }- p {- font-size: 13px;- color: var(--td-text-color-placeholder);- margin: 0;- line-height: 1.5;- }+ p {+ font-size: 13px;+ color: var(--td-text-color-placeholder);+ margin: 0;+ line-height: 1.5;}}@@ -397,6 +394,11 @@ onMounted(() => {display: grid;grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));gap: 12px;++ .service-card--add {+ width: 100%;+ height: 100%;+ }}// Transport-distinguished card. 与 ModelSettings / WebSearchSettings 同形。@@ -433,6 +435,51 @@ onMounted(() => {box-shadow: none;border-color: var(--td-component-stroke);}++ &--add {+ flex-direction: column;+ align-items: center;+ justify-content: center;+ gap: 8px;+ min-height: 68px;+ border-style: dashed;+ background: transparent;+ color: var(--td-text-color-placeholder);+ cursor: pointer;+ font: inherit;+ text-align: center;++ &:hover,+ &:focus-visible {+ color: var(--td-brand-color);+ border-color: var(--td-brand-color);+ background: color-mix(in srgb, var(--td-brand-color) 6%, transparent);+ box-shadow: none;+ }++ &:focus-visible {+ outline: 2px solid var(--td-brand-color);+ outline-offset: 2px;+ }++ &__icon {+ display: flex;+ align-items: center;+ justify-content: center;+ width: 32px;+ height: 32px;+ border-radius: 8px;+ background: color-mix(in srgb, var(--td-brand-color) 10%, transparent);+ color: var(--td-brand-color);+ font-size: 18px;+ }++ &__label {+ font-size: 13px;+ font-weight: 500;+ line-height: 1.4;+ }+ }}.service-card__actions {diff --git a/frontend/src/views/settings/VectorStoreSettings.vue b/frontend/src/views/settings/VectorStoreSettings.vueindex 3868ec362..f8cdbb14b 100644--- a/frontend/src/views/settings/VectorStoreSettings.vue+++ b/frontend/src/views/settings/VectorStoreSettings.vue@@ -12,13 +12,7 @@<template v-else><div class="settings-group">- <div class="section-subheader">- <h3>{{ t('vectorStoreSettings.storesTitle') }}</h3>- <t-button v-if="authStore.hasRole('admin')" theme="primary" variant="outline" size="small" @click="openAddDialog">- <template #icon><add-icon /></template>- {{ t('vectorStoreSettings.addStore') }}- </t-button>- </div>+ <h3 class="list-section-title">{{ t('vectorStoreSettings.storesTitle') }}</h3><!-- 与其它 settings 列表同形:左侧 engine 徽章 + 标题 + env pill + 副标题 + 测试动作。env 来源是只读的 (engine_type / connection_config 由 .env 写入),所以没有更多菜单;@@ -93,11 +87,28 @@</div></div></div>+ <button+ v-if="authStore.hasRole('admin')"+ type="button"+ class="store-card store-card--add"+ @click="openAddDialog"+ >+ <span class="store-card--add__icon" aria-hidden="true">+ <add-icon />+ </span>+ <span class="store-card--add__label">{{ t('vectorStoreSettings.addStore') }}</span>+ </button></div><!-- Empty State --><div v-else class="empty-stores">- <p>{{ t('vectorStoreSettings.emptyDesc') }}</p>+ <t-empty :description="t('vectorStoreSettings.emptyDesc')">+ <t-button v-if="authStore.hasRole('admin')" theme="primary" variant="outline" size="small"+ @click="openAddDialog">+ <template #icon><add-icon /></template>+ {{ t('vectorStoreSettings.addStore') }}+ </t-button>+ </t-empty></div></div></template>@@ -785,24 +796,22 @@ onMounted(async () => {flex-direction: column;}-.section-subheader {- display: flex;- align-items: center;- justify-content: space-between;- margin-bottom: 16px;-- h3 {- font-size: 16px;- font-weight: 600;- color: var(--td-text-color-primary);- margin: 0;- }+.list-section-title {+ font-size: 16px;+ font-weight: 600;+ color: var(--td-text-color-primary);+ margin: 0 0 16px 0;}.store-grid {display: grid;grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));gap: 12px;++ .store-card--add {+ width: 100%;+ height: 100%;+ }}// 与 Parser / Storage / Model 等同形:徽章 + 三段式。env 来源走 secondaryContainer@@ -839,6 +848,51 @@ onMounted(async () => {border-color: var(--td-component-stroke);box-shadow: none;}++ &--add {+ flex-direction: column;+ align-items: center;+ justify-content: center;+ gap: 8px;+ min-height: 68px;+ border-style: dashed;+ background: transparent;+ color: var(--td-text-color-placeholder);+ cursor: pointer;+ font: inherit;+ text-align: center;++ &:hover,+ &:focus-visible {+ color: var(--td-brand-color);+ border-color: var(--td-brand-color);+ background: color-mix(in srgb, var(--td-brand-color) 6%, transparent);+ box-shadow: none;+ }++ &:focus-visible {+ outline: 2px solid var(--td-brand-color);+ outline-offset: 2px;+ }++ &__icon {+ display: flex;+ align-items: center;+ justify-content: center;+ width: 32px;+ height: 32px;+ border-radius: 8px;+ background: color-mix(in srgb, var(--td-brand-color) 10%, transparent);+ color: var(--td-brand-color);+ font-size: 18px;+ }++ &__label {+ font-size: 13px;+ font-weight: 500;+ line-height: 1.4;+ }+ }}.store-card__actions {@@ -1032,12 +1086,14 @@ onMounted(async () => {.empty-stores {- padding: 48px 32px;+ padding: 64px 0;text-align: center;- color: var(--td-text-color-placeholder);- border: 1px dashed var(--td-component-stroke);- border-radius: 8px;- font-size: 14px;++ :deep(.t-empty__description) {+ font-size: 14px;+ color: var(--td-text-color-placeholder);+ margin-bottom: 16px;+ }}// ---- 抽屉内容 — 与 ModelEditorDialog 同款约定 ----diff --git a/frontend/src/views/settings/WebSearchSettings.vue b/frontend/src/views/settings/WebSearchSettings.vueindex e45794ae7..51fc3706e 100644--- a/frontend/src/views/settings/WebSearchSettings.vue+++ b/frontend/src/views/settings/WebSearchSettings.vue@@ -5,13 +5,7 @@<p class="section-description">{{ t('webSearchSettings.description') }}</p></div>- <div class="settings-toolbar">- <h3>{{ t('webSearchSettings.providersTitle') }}</h3>- <t-button v-if="authStore.hasRole('admin')" theme="primary" variant="outline" size="small" @click="openAddDialog">- <template #icon><add-icon /></template>- {{ t('webSearchSettings.addProvider') }}- </t-button>- </div>+ <h3 class="list-section-title">{{ t('webSearchSettings.providersTitle') }}</h3><!-- Provider List —— 与 ModelSettings 的卡片同形:左侧标识徽章 + 标题 / 副标题 / proxy URL 三段式。不复用 SettingCard 的原因和 Models 一样:每页有微妙不同的右上侧栏需求(这里没有控件,@@ -76,6 +70,17 @@</div></div></div>+ <button+ v-if="authStore.hasRole('admin')"+ type="button"+ class="provider-card provider-card--add"+ @click="openAddDialog"+ >+ <span class="provider-card--add__icon" aria-hidden="true">+ <add-icon />+ </span>+ <span class="provider-card--add__label">{{ t('webSearchSettings.addProvider') }}</span>+ </button></div><!-- Empty State -->@@ -676,24 +681,22 @@ onMounted(async () => {}}-.settings-toolbar {- display: flex;- align-items: center;- justify-content: space-between;- margin-bottom: 16px;-- h3 {- font-size: 16px;- font-weight: 600;- color: var(--td-text-color-primary);- margin: 0;- }+.list-section-title {+ font-size: 16px;+ font-weight: 600;+ color: var(--td-text-color-primary);+ margin: 0 0 16px 0;}.provider-grid {display: grid;grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));gap: 12px;++ .provider-card--add {+ width: 100%;+ height: 100%;+ }}// 卡片视觉与 ModelSettings 的 model-card 同构(徽章 + 标题 / 副标题 / url 三段式)。@@ -723,6 +726,51 @@ onMounted(async () => {outline-offset: 2px;}}++ &--add {+ flex-direction: column;+ align-items: center;+ justify-content: center;+ gap: 8px;+ min-height: 68px;+ border-style: dashed;+ background: transparent;+ color: var(--td-text-color-placeholder);+ cursor: pointer;+ font: inherit;+ text-align: center;++ &:hover,+ &:focus-visible {+ color: var(--td-brand-color);+ border-color: var(--td-brand-color);+ background: color-mix(in srgb, var(--td-brand-color) 6%, transparent);+ box-shadow: none;+ }++ &:focus-visible {+ outline: 2px solid var(--td-brand-color);+ outline-offset: 2px;+ }++ &__icon {+ display: flex;+ align-items: center;+ justify-content: center;+ width: 32px;+ height: 32px;+ border-radius: 8px;+ background: color-mix(in srgb, var(--td-brand-color) 10%, transparent);+ color: var(--td-brand-color);+ font-size: 18px;+ }++ &__label {+ font-size: 13px;+ font-weight: 500;+ line-height: 1.4;+ }+ }}.provider-card__actions {