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: '' }, +]