From 1610988c2eed179de0d53d50e6402a1704bd3f4f Mon Sep 17 00:00:00 2001 From: opsx Date: Sat, 31 Oct 2026 15:23:26 +0800 Subject: [PATCH] =?UTF-8?q?feat(aiops):=20=E6=A8=A1=E5=9E=8B=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=8F=82=E8=80=83=20aiops/opsxshell=20=E2=80=94=20?= =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E9=A2=84=E8=AE=BE=20+=20=E4=BE=9B=E5=BA=94?= =?UTF-8?q?=E5=95=86=E4=B8=8B=E6=8B=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 快捷预设:deepseek-flash(推荐)/ deepseek-v4-pro / 自定义 一键填入端点与模型 - 供应商目录(9 家 + 自定义):DeepSeek/通义/智谱/Kimi/MiniMax/硅基流动/混元/OpenAI/本地 Ollama·vLLM,选择后自动填 Base URL 与首个推荐模型 - 模型输入支持 datalist 下拉(随供应商联动)且可手输任意模型名;Base URL 保持可编辑 --- frontend/src/i18n/locales/en/aiops.ts | 4 ++ frontend/src/i18n/locales/zh/aiops.ts | 4 ++ frontend/src/pages/aiops/index.tsx | 73 +++++++++++++++++--- frontend/src/pages/aiops/llmProviders.ts | 85 ++++++++++++++++++++++++ 4 files changed, 157 insertions(+), 9 deletions(-) create mode 100644 frontend/src/pages/aiops/llmProviders.ts diff --git a/frontend/src/i18n/locales/en/aiops.ts b/frontend/src/i18n/locales/en/aiops.ts index 57013d6..03cbb74 100644 --- a/frontend/src/i18n/locales/en/aiops.ts +++ b/frontend/src/i18n/locales/en/aiops.ts @@ -54,6 +54,10 @@ export default { }, config: { + quickPresets: 'Quick presets', + presetCustom: 'Custom', + presetHint: 'DeepSeek official picks; custom accepts any OpenAI-compatible endpoint', + providerSelectHint: 'Pick a provider to autofill endpoint and model', enabled: 'Enable AI analysis', enabledHint: 'When off, Analyze returns a clear "not enabled" message', provider: 'Protocol', diff --git a/frontend/src/i18n/locales/zh/aiops.ts b/frontend/src/i18n/locales/zh/aiops.ts index ebb6dfc..a5614e4 100644 --- a/frontend/src/i18n/locales/zh/aiops.ts +++ b/frontend/src/i18n/locales/zh/aiops.ts @@ -54,6 +54,10 @@ export default { }, config: { + quickPresets: '快捷预设', + presetCustom: '自定义', + presetHint: 'DeepSeek 官方推荐;自定义可手填任意 OpenAI 兼容端点', + providerSelectHint: '选择供应商自动填入端点与推荐模型', enabled: '启用 AI 分析', enabledHint: '关闭后「开始分析」会直接提示未启用,不影响其它功能', provider: '协议', diff --git a/frontend/src/pages/aiops/index.tsx b/frontend/src/pages/aiops/index.tsx index 72e9ab5..4ec7170 100644 --- a/frontend/src/pages/aiops/index.tsx +++ b/frontend/src/pages/aiops/index.tsx @@ -1,5 +1,6 @@ import { useCallback, useEffect, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' +import { LLM_PROVIDERS, matchProvider } from './llmProviders' import { Loader2, Play, Save, Sparkles, PlugZap, History, ShieldCheck } from 'lucide-react' import { toast } from 'sonner' import { PageContainer } from '@/components/PageContainer' @@ -8,6 +9,7 @@ import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { Switch } from '@/components/ui/switch' +import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select' import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs' import { Textarea } from '@/components/ui/textarea' import { Badge } from '@/components/ui/badge' @@ -479,8 +481,70 @@ export default function AiopsPage() { +
+
+ +
+ {LLM_PROVIDERS.filter(p => p.id === 'deepseek')[0].models.slice(0, 2).reverse().concat([]).map(m => ( + + ))} + +
+

{t('config.presetHint')}

+
+
+
+ + +

{t('config.providerSelectHint')}

+
+
+ + setConfig({ ...config, model: e.target.value })} + /> + + {(LLM_PROVIDERS.find(p => p.id === matchProvider(config.baseUrl))?.models ?? []).map(m => ( + +

{t('config.modelHint')}

+
+

{t('config.baseUrlHint')}

-
- - setConfig({ ...config, model: e.target.value })} - /> -

{t('config.modelHint')}

-
p.endpoint && p.endpoint === baseUrl) + return hit?.id ?? 'custom' +} + +/** 推荐预设:一键填入 endpoint + 模型 */ +export const QUICK_PRESETS = [ + { id: 'flash', label: 'DeepSeek Flash(推荐)', provider: 'deepseek', model: 'deepseek-flash' }, + { id: 'pro', label: 'DeepSeek V4 Pro', provider: 'deepseek', model: 'deepseek-v4-pro' }, + { id: 'custom', label: '自定义', provider: 'custom', model: '' }, +]