Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

refactor(settings): group sidebar nav items into labeled sections

wizardchenb0b7cfa351bc
diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts
index d582ef0a9..53f4d6383 100755
--- a/frontend/src/i18n/locales/en-US.ts
+++ b/frontend/src/i18n/locales/en-US.ts
@@ -635,6 +635,13 @@ export default {
systemSettings: 'System Settings',
tenantInfo: 'Tenant Info',
apiInfo: 'API Info',
+ navGroups: {
+ basic: 'Basic',
+ ai: 'AI Capabilities',
+ data: 'Data & Engines',
+ workspace: 'Workspace & Access',
+ system: 'System Info',
+ },
weknoraCloud: {
title: 'WeKnora Cloud',
description: 'Configure WeKnora Cloud APPID and APPSECRET credentials. Credentials are used for model services and document parsing engine.',
diff --git a/frontend/src/i18n/locales/ko-KR.ts b/frontend/src/i18n/locales/ko-KR.ts
index ec6ce70e5..f39baec69 100755
--- a/frontend/src/i18n/locales/ko-KR.ts
+++ b/frontend/src/i18n/locales/ko-KR.ts
@@ -511,6 +511,13 @@ export default {
systemSettings: "시스템 설정",
tenantInfo: "테넌트 정보",
apiInfo: "API 정보",
+ navGroups: {
+ basic: "기본",
+ ai: "AI 기능",
+ data: "데이터 및 엔진",
+ workspace: "공간 및 권한",
+ system: "시스템 정보",
+ },
weknoraCloud: {
title: 'WeKnora Cloud',
description: 'WeKnora Cloud APPID 및 APPSECRET 자격 증명을 설정합니다. 자격 증명은 모델 서비스와 문서 파싱 엔진에 사용됩니다.',
diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.ts
index 0b662a68b..f0c9af6df 100755
--- a/frontend/src/i18n/locales/ru-RU.ts
+++ b/frontend/src/i18n/locales/ru-RU.ts
@@ -620,6 +620,13 @@ export default {
systemSettings: 'Настройки системы',
tenantInfo: 'Информация о арендаторе',
apiInfo: 'Информация API',
+ navGroups: {
+ basic: 'Основное',
+ ai: 'AI-возможности',
+ data: 'Данные и движки',
+ workspace: 'Пространство и доступ',
+ system: 'Сведения о системе',
+ },
weknoraCloud: {
title: 'WeKnora Cloud',
description: 'Настройте учётные данные APPID и APPSECRET для WeKnora Cloud. Данные используются для модельных сервисов и движка парсинга документов.',
diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts
index 24c6e703c..fec0a873b 100755
--- a/frontend/src/i18n/locales/zh-CN.ts
+++ b/frontend/src/i18n/locales/zh-CN.ts
@@ -508,6 +508,13 @@ export default {
systemSettings: "系统设置",
tenantInfo: "租户信息",
apiInfo: "API信息",
+ navGroups: {
+ basic: "基础",
+ ai: "AI 能力",
+ data: "数据与引擎",
+ workspace: "空间与权限",
+ system: "系统信息",
+ },
weknoraCloud: {
title: "WeKnora Cloud",
description: "配置 WeKnora Cloud 的 APPID 和 APPSECRET 凭证。凭证用于模型服务和文档解析引擎。",
diff --git a/frontend/src/views/settings/Settings.vue b/frontend/src/views/settings/Settings.vue
index 5d645b541..c4e7c42dd 100644
--- a/frontend/src/views/settings/Settings.vue
+++ b/frontend/src/views/settings/Settings.vue
@@ -17,69 +17,72 @@
<h2 class="sidebar-title">{{ $t('general.settings') }}</h2>
</div>
<div class="settings-nav">
- <template v-for="(item, index) in navItems" :key="index">
- <div
- :class="['nav-item', {
- 'active': currentSection === item.key,
- 'has-submenu': item.children && item.children.length > 0,
- 'expanded': expandedMenus.includes(item.key)
- }]"
- @click="handleNavClick(item)"
- >
- <!-- 网络搜索使用自定义 SVG 图标 -->
- <svg
- v-if="item.key === 'websearch'"
- width="18"
- height="18"
- viewBox="0 0 18 18"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- class="nav-icon"
- >
- <circle cx="9" cy="9" r="7" stroke="currentColor" stroke-width="1.2" fill="none"/>
- <path d="M 9 2 A 3.5 7 0 0 0 9 16" stroke="currentColor" stroke-width="1.2" fill="none"/>
- <path d="M 9 2 A 3.5 7 0 0 1 9 16" stroke="currentColor" stroke-width="1.2" fill="none"/>
- <line x1="2.94" y1="5.5" x2="15.06" y2="5.5" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
- <line x1="2.94" y1="12.5" x2="15.06" y2="12.5" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
- </svg>
- <!-- WeKnora Cloud 使用自定义 W 图标 -->
- <svg
- v-else-if="item.key === 'weknoracloud'"
- width="18"
- height="18"
- viewBox="0 0 18 18"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- class="nav-icon"
- >
- <rect x="1.5" y="1.5" width="15" height="15" rx="3.5" stroke="currentColor" stroke-width="1.2" fill="none"/>
- <path d="M4.5 5.5L6.5 12.5L9 7.5L11.5 12.5L13.5 5.5" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" fill="none"/>
- </svg>
- <t-icon v-else :name="item.icon" class="nav-icon" />
- <span class="nav-label">{{ item.label }}</span>
- <t-icon
- v-if="item.children && item.children.length > 0"
- :name="expandedMenus.includes(item.key) ? 'chevron-down' : 'chevron-right'"
- class="expand-icon"
- />
- </div>
-
- <!-- 子菜单 -->
- <Transition name="submenu">
+ <template v-for="group in navGroups" :key="group.key">
+ <div class="nav-group-title">{{ group.label }}</div>
+ <template v-for="item in group.items" :key="item.key">
<div
- v-if="item.children && expandedMenus.includes(item.key)"
- class="submenu"
+ :class="['nav-item', {
+ 'active': currentSection === item.key,
+ 'has-submenu': item.children && item.children.length > 0,
+ 'expanded': expandedMenus.includes(item.key)
+ }]"
+ @click="handleNavClick(item)"
>
- <div
- v-for="(child, childIndex) in item.children"
- :key="childIndex"
- :class="['submenu-item', { 'active': currentSubSection === child.key }]"
- @click.stop="handleSubMenuClick(item.key, child.key)"
+ <!-- 网络搜索使用自定义 SVG 图标 -->
+ <svg
+ v-if="item.key === 'websearch'"
+ width="18"
+ height="18"
+ viewBox="0 0 18 18"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ class="nav-icon"
>
- <span class="submenu-label">{{ child.label }}</span>
- </div>
+ <circle cx="9" cy="9" r="7" stroke="currentColor" stroke-width="1.2" fill="none"/>
+ <path d="M 9 2 A 3.5 7 0 0 0 9 16" stroke="currentColor" stroke-width="1.2" fill="none"/>
+ <path d="M 9 2 A 3.5 7 0 0 1 9 16" stroke="currentColor" stroke-width="1.2" fill="none"/>
+ <line x1="2.94" y1="5.5" x2="15.06" y2="5.5" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
+ <line x1="2.94" y1="12.5" x2="15.06" y2="12.5" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
+ </svg>
+ <!-- WeKnora Cloud 使用自定义 W 图标 -->
+ <svg
+ v-else-if="item.key === 'weknoracloud'"
+ width="18"
+ height="18"
+ viewBox="0 0 18 18"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ class="nav-icon"
+ >
+ <rect x="1.5" y="1.5" width="15" height="15" rx="3.5" stroke="currentColor" stroke-width="1.2" fill="none"/>
+ <path d="M4.5 5.5L6.5 12.5L9 7.5L11.5 12.5L13.5 5.5" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" fill="none"/>
+ </svg>
+ <t-icon v-else :name="item.icon" class="nav-icon" />
+ <span class="nav-label">{{ item.label }}</span>
+ <t-icon
+ v-if="item.children && item.children.length > 0"
+ :name="expandedMenus.includes(item.key) ? 'chevron-down' : 'chevron-right'"
+ class="expand-icon"
+ />
</div>
- </Transition>
+
+ <!-- 子菜单 -->
+ <Transition name="submenu">
+ <div
+ v-if="item.children && expandedMenus.includes(item.key)"
+ class="submenu"
+ >
+ <div
+ v-for="(child, childIndex) in item.children"
+ :key="childIndex"
+ :class="['submenu-item', { 'active': currentSubSection === child.key }]"
+ @click.stop="handleSubMenuClick(item.key, child.key)"
+ >
+ <span class="submenu-label">{{ child.label }}</span>
+ </div>
+ </div>
+ </Transition>
+ </template>
</template>
</div>
</div>
@@ -196,23 +199,26 @@ const currentSection = ref<string>('general')
const currentSubSection = ref<string>('')
const expandedMenus = ref<string[]>([])
+type NavItem = {
+ key: string
+ icon: string
+ label: string
+ children?: Array<{ key: string; label: string }>
+}
+
+type NavGroup = {
+ key: string
+ label: string
+ items: NavItem[]
+}
+
const navItems = computed(() => {
- // Optional `children` keeps the existing template's submenu plumbing
- // happy (it iterates `item.children`); none of the current tabs use
- // it, but staying compatible avoids introducing a new typing-only
- // diff scattered across the template.
- type NavItem = {
- key: string
- icon: string
- label: string
- children?: Array<{ key: string; label: string }>
- }
const items: NavItem[] = [
{ key: 'general', icon: 'setting', label: t('general.title') },
{ key: 'ollama', icon: 'server', label: 'Ollama' },
{ key: 'weknoracloud', icon: '', label: 'WeKnora Cloud' },
{ key: 'models', icon: 'control-platform', label: t('settings.modelManagement') },
- { key: 'websearch', icon: 'search', label: t('settings.webSearchConfig') },
+ { key: 'websearch', icon: 'search', label: t('settings.webSearchConfig') },
{ key: 'chathistory', icon: 'chat', label: t('chatHistorySettings.title') },
{ key: 'vectorstore', icon: 'data-base', label: t('settings.vectorStoreEngine') },
{ key: 'parser', icon: 'file-search', label: t('settings.parserEngine') },
@@ -232,6 +238,18 @@ const navItems = computed(() => {
return items
})
+const navGroups = computed<NavGroup[]>(() => {
+ const itemMap = new Map(navItems.value.map((item) => [item.key, item]))
+ const pickItems = (keys: string[]) => keys.map((key) => itemMap.get(key)).filter(Boolean) as NavItem[]
+ return [
+ { key: 'basic', label: t('settings.navGroups.basic'), items: pickItems(['general']) },
+ { key: 'ai', label: t('settings.navGroups.ai'), items: pickItems(['models', 'ollama', 'weknoracloud', 'websearch', 'mcp']) },
+ { key: 'data', label: t('settings.navGroups.data'), items: pickItems(['vectorstore', 'parser', 'storage']) },
+ { key: 'workspace', label: t('settings.navGroups.workspace'), items: pickItems(['tenant', 'members']) },
+ { key: 'system', label: t('settings.navGroups.system'), items: pickItems(['chathistory', 'system', 'api']) },
+ ].filter((group) => group.items.length > 0)
+})
+
// 导航项点击处理
const handleNavClick = (item: any) => {
if (item.children && item.children.length > 0) {
@@ -421,15 +439,23 @@ onUnmounted(() => {
}
.settings-nav {
- padding: 16px 8px;
+ padding: 12px 8px 16px;
flex: 1;
}
+.nav-group-title {
+ padding: 12px 16px 6px;
+ color: var(--td-text-color-placeholder);
+ font-size: 12px;
+ font-weight: 600;
+ letter-spacing: 0.02em;
+}
+
.nav-item {
display: flex;
align-items: center;
- padding: 10px 16px;
- margin-bottom: 4px;
+ padding: 8px 16px;
+ margin-bottom: 2px;
border-radius: 6px;
cursor: pointer;
color: var(--td-text-color-secondary);