From b81b31f322605b43c650f1c6add2ea0570a08fee Mon Sep 17 00:00:00 2001 From: opsx Date: Sat, 31 Oct 2026 23:41:43 +0800 Subject: [PATCH] =?UTF-8?q?feat(aiops):=20=E6=A8=A1=E5=9E=8B=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E9=BB=98=E8=AE=A4=20DeepSeek/flash=20+=20=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E5=90=8D=E7=9C=9F=E4=B8=8B=E6=8B=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 首次进入配置页自动预填 DeepSeek 端点与 deepseek-flash(只需填 Key);模型名从 datalist 换 shadcn Select(随供应商联动,末项「自定义模型…」转手输) --- frontend/src/i18n/locales/en/aiops.ts | 1 + frontend/src/i18n/locales/zh/aiops.ts | 1 + frontend/src/pages/aiops/index.tsx | 39 ++++++++++++++++++--------- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/frontend/src/i18n/locales/en/aiops.ts b/frontend/src/i18n/locales/en/aiops.ts index 67e7ebf..15182e7 100644 --- a/frontend/src/i18n/locales/en/aiops.ts +++ b/frontend/src/i18n/locales/en/aiops.ts @@ -58,6 +58,7 @@ export default { }, config: { + customModel: 'Custom model…', advanced: 'Advanced', providerSelectHint: 'Pick a provider to autofill endpoint and model', enabled: 'Enable AI analysis', diff --git a/frontend/src/i18n/locales/zh/aiops.ts b/frontend/src/i18n/locales/zh/aiops.ts index b8b5879..120e521 100644 --- a/frontend/src/i18n/locales/zh/aiops.ts +++ b/frontend/src/i18n/locales/zh/aiops.ts @@ -58,6 +58,7 @@ export default { }, config: { + customModel: '自定义模型…', advanced: '高级设置', providerSelectHint: '选择供应商自动填入端点与推荐模型', enabled: '启用 AI 分析', diff --git a/frontend/src/pages/aiops/index.tsx b/frontend/src/pages/aiops/index.tsx index 2013fe7..da1e950 100644 --- a/frontend/src/pages/aiops/index.tsx +++ b/frontend/src/pages/aiops/index.tsx @@ -106,7 +106,14 @@ export default function AiopsPage() { aiApi .getConfig() .then((res: AIConfigResponse) => { - setConfig(res.config) + const cfg = res.config + // 首次配置默认 DeepSeek + 最新 flash:用户只需填 API Key + if (cfg && !cfg.baseUrl && !cfg.model) { + const deepseek = LLM_PROVIDERS.find(p => p.id === 'deepseek')! + cfg.baseUrl = deepseek.endpoint + cfg.model = 'deepseek-flash' + } + setConfig(cfg) setEnabled(Boolean(res.config?.enabled)) setRedactText((res.config?.redactExtra ?? []).join('\n')) setUsedToday(res.tokenUsedToday ?? 0) @@ -540,17 +547,25 @@ export default function AiopsPage() {
- setConfig({ ...config, model: e.target.value })} - /> - - {(LLM_PROVIDERS.find(p => p.id === matchProvider(config.baseUrl))?.models ?? []).map(m => ( - + {((LLM_PROVIDERS.find(p => p.id === matchProvider(config.baseUrl))?.models ?? ['deepseek-flash'])).includes(config.model) || !config.model ? ( + + ) : ( + setConfig({ ...config, model: e.target.value })} /> + )}

{t('config.modelHint')}

{matchProvider(config.baseUrl) === 'custom' && (