From 37a610b6036c680985f3d7422249432ae580d600 Mon Sep 17 00:00:00 2001 From: opsx Date: Sun, 1 Nov 2026 01:38:43 +0800 Subject: [PATCH] =?UTF-8?q?refactor(settings):=20AI=20=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E6=8E=A5=E5=85=A5=E6=8B=86=E4=B8=BA=E7=8B=AC=E7=AB=8B=20tab=20?= =?UTF-8?q?=E9=A1=B5(/settings/ai)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 系统设置分组 tab 顺序:通用配置 → 用户管理 → 审计日志 → LDAP 接入 → AI 模型接入 → 默认镜像源;设置主页去掉内嵌卡片,子页复用 AiModelSection --- frontend/src/i18n/locales/en/common.ts | 1 + frontend/src/i18n/locales/zh/common.ts | 1 + frontend/src/pages/settings/ai.tsx | 16 ++++++++++++++++ frontend/src/pages/settings/index.tsx | 2 -- frontend/src/router/routes.tsx | 5 ++++- 5 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 frontend/src/pages/settings/ai.tsx diff --git a/frontend/src/i18n/locales/en/common.ts b/frontend/src/i18n/locales/en/common.ts index aa86341..ef7973d 100644 --- a/frontend/src/i18n/locales/en/common.ts +++ b/frontend/src/i18n/locales/en/common.ts @@ -19,6 +19,7 @@ export default { analysis: 'Log analysis', settings: 'General', ldap: 'LDAP', + aiModel: 'AI Model', registry: 'Image Registry', users: 'Users', audit: 'Audit Log', diff --git a/frontend/src/i18n/locales/zh/common.ts b/frontend/src/i18n/locales/zh/common.ts index 919c83b..14727d0 100644 --- a/frontend/src/i18n/locales/zh/common.ts +++ b/frontend/src/i18n/locales/zh/common.ts @@ -19,6 +19,7 @@ export default { analysis: '日志分析', settings: '通用配置', ldap: 'LDAP 接入', + aiModel: 'AI 模型接入', registry: '默认镜像源', users: '用户管理', audit: '审计日志', diff --git a/frontend/src/pages/settings/ai.tsx b/frontend/src/pages/settings/ai.tsx new file mode 100644 index 0000000..8c05903 --- /dev/null +++ b/frontend/src/pages/settings/ai.tsx @@ -0,0 +1,16 @@ +import { memo } from 'react' +import { useTranslation } from 'react-i18next' +import { PageContainer } from '@/components/PageContainer' +import { AiModelSection } from './components/AiModelSection' + +/** AI 模型接入:系统设置分组的一个 tab(原设置页通用配置内的卡片拆出) */ +const AiModelPage = memo(function AiModelPage() { + const { t } = useTranslation('aiops') + return ( + + + + ) +}) + +export default AiModelPage diff --git a/frontend/src/pages/settings/index.tsx b/frontend/src/pages/settings/index.tsx index 1c0b235..ebfbc8c 100644 --- a/frontend/src/pages/settings/index.tsx +++ b/frontend/src/pages/settings/index.tsx @@ -13,7 +13,6 @@ import { PageContainer } from '@/components/PageContainer' import { ThemeSection } from './components/ThemeSection' import { RetentionSection } from './components/RetentionSection' import { LicenseSection } from './components/LicenseSection' -import { AiModelSection } from './components/AiModelSection' import { LanguageSection } from '@/i18n/LanguageSection' import { Palette } from 'lucide-react' @@ -72,7 +71,6 @@ const SettingsPage = memo(function SettingsPage() { return ( - {/* 不再有内层 tab:LDAP / 镜像源 已拆成独立路由, 由左侧「系统设置」分组的顶层 tab 切换(单层 tab 更好理解)。 */}
diff --git a/frontend/src/router/routes.tsx b/frontend/src/router/routes.tsx index cbd41a5..c98d762 100644 --- a/frontend/src/router/routes.tsx +++ b/frontend/src/router/routes.tsx @@ -19,6 +19,7 @@ import { Boxes, ShieldCheck, Container, + Bot, } from 'lucide-react'; import type { AppRoute, MenuItem, RouteMeta } from '@/types/router'; @@ -32,6 +33,7 @@ const Collectors = lazy(() => import('@/pages/collectors')); const SettingsPage = lazy(() => import('@/pages/settings')); const LdapPage = lazy(() => import('@/pages/settings/ldap')); const RegistryPage = lazy(() => import('@/pages/settings/registry')); +const AiModelPage = lazy(() => import('@/pages/settings/ai')); const NotFound = lazy(() => import('@/pages/not-found')); const WizardPage = lazy(() => import('@/pages/wizard')); const LogsPage = lazy(() => import('@/pages/logs')); @@ -88,7 +90,8 @@ export const routes: AppRoute[] = [ }, { path: '/audit', component: AuditPage, auth: true, meta: { title: 'menu.audit', icon: History, order: 10, adminOnly: true, groupKey: 'system', proOnly: true } }, { path: '/settings/ldap', component: LdapPage, auth: true, meta: { title: 'menu.ldap', icon: ShieldCheck, order: 11, adminOnly: true, groupKey: 'system' } }, - { path: '/settings/registry', component: RegistryPage, auth: true, meta: { title: 'menu.registry', icon: Container, order: 12, adminOnly: true, groupKey: 'system' } }, + { path: '/settings/registry', component: RegistryPage, auth: true, meta: { title: 'menu.registry', icon: Container, order: 13, adminOnly: true, groupKey: 'system' } }, + { path: '/settings/ai', component: AiModelPage, auth: true, meta: { title: 'menu.aiModel', icon: Bot, order: 12, adminOnly: true, groupKey: 'system' } }, // 系统设置放回侧栏,并作为「系统设置」分组的 tab 起点(order 最小 = 排在第一个) { path: '/settings', component: SettingsPage, auth: true,