From 2efbed882af04739a8c5f49739ecd502e1651670 Mon Sep 17 00:00:00 2001 From: opsx Date: Sun, 1 Nov 2026 00:26:22 +0800 Subject: [PATCH] =?UTF-8?q?fix(aiops):=20=E4=BF=9D=E5=AD=98=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=90=8E=E5=88=86=E6=9E=90=E9=A1=B5=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E5=8D=B3=E6=97=B6=E5=90=8C=E6=AD=A5;=E5=88=86=E6=9E=90?= =?UTF-8?q?=E9=A1=B5=E5=B8=83=E5=B1=80=E9=87=8D=E6=8E=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - enabled 状态在 saveConfig 成功后立即 setEnabled(此前只更新 config, 导致'AI 分析未启用'横幅要等下次请求才消失) - 布局:工具栏改 4 列网格(数据源/时间/应用/问题),执行按钮与提示移到 分隔线下右对齐;未启用横幅加 ✦ 图标 + 「去配置」直达按钮;空态/加载态 加图标居中;消耗行改统计卡风格(数值 tabular 高亮) --- frontend/src/i18n/locales/en/aiops.ts | 1 + frontend/src/i18n/locales/zh/aiops.ts | 1 + frontend/src/pages/aiops/index.tsx | 64 ++++++++++++++++----------- 3 files changed, 39 insertions(+), 27 deletions(-) diff --git a/frontend/src/i18n/locales/en/aiops.ts b/frontend/src/i18n/locales/en/aiops.ts index 38ae7ea..59b86b0 100644 --- a/frontend/src/i18n/locales/en/aiops.ts +++ b/frontend/src/i18n/locales/en/aiops.ts @@ -20,6 +20,7 @@ export default { }, analyze: { + goConfig: 'Open config', appScope: 'App scope', allApps: 'All apps', appRequired: 'Required (over 1h)', diff --git a/frontend/src/i18n/locales/zh/aiops.ts b/frontend/src/i18n/locales/zh/aiops.ts index 349c76e..8129aa2 100644 --- a/frontend/src/i18n/locales/zh/aiops.ts +++ b/frontend/src/i18n/locales/zh/aiops.ts @@ -20,6 +20,7 @@ export default { }, analyze: { + goConfig: '去配置', appScope: '应用范围', allApps: '全部应用', appRequired: '必选(超过 1 小时)', diff --git a/frontend/src/pages/aiops/index.tsx b/frontend/src/pages/aiops/index.tsx index 8316bc4..02e579c 100644 --- a/frontend/src/pages/aiops/index.tsx +++ b/frontend/src/pages/aiops/index.tsx @@ -190,6 +190,7 @@ export default function AiopsPage() { .filter(Boolean), }) setConfig(res.config) + setEnabled(Boolean(res.config?.enabled)) setApiKeyInput('') toast.success('配置已保存') } catch (err) { @@ -245,13 +246,16 @@ export default function AiopsPage() { {/* ─────────── 分析 ─────────── */} {!enabled && ( -
- {t('analyze.notEnabled')} +
+ + {t('analyze.notEnabled')} +
)} - + +
setQuestion(e.target.value)} - className="h-9" - /> +
+ + setQuestion(e.target.value)} + className="h-9" + /> +
+
+
+

{t('analyze.runHint')}

+
- -
{t('analyze.runHint')}
{!outcome && !running && ( - {t('analyze.empty')} + + +

{t('analyze.empty')}

+
)} {running && ( - - - {t('analyze.running')} + + +

{t('analyze.running')}

+

{t('analyze.runHint')}

)} @@ -334,13 +345,12 @@ export default function AiopsPage() { {outcome && ( <> {/* 本次消耗:让成本和延迟是可见的 */} -
- - {t('analyze.lastRun')}:{t('analyze.promptTokens')} {fmtNum(outcome.run.promptTokens)} ·{' '} - {t('analyze.completionTokens')} {fmtNum(outcome.run.completionTokens)} · {t('analyze.duration')}{' '} - {(outcome.run.durationMs / 1000).toFixed(1)}s - -