From d036de3138c957f463043e1fc339db93798e0081 Mon Sep 17 00:00:00 2001 From: liuwei Date: Wed, 6 May 2026 09:25:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=8B=E7=BC=A9=E9=A6=96=E9=A1=B5LLM?= =?UTF-8?q?=E4=B8=8E=E4=BB=BB=E5=8A=A1=E8=B0=83=E5=BA=A6=E5=AD=90=E5=8D=A1?= =?UTF-8?q?=E7=89=87=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/dashboard/templates/index.html | 94 +++++++++++----------------- 1 file changed, 36 insertions(+), 58 deletions(-) diff --git a/admin/dashboard/templates/index.html b/admin/dashboard/templates/index.html index 72d4c2b..ded72f7 100644 --- a/admin/dashboard/templates/index.html +++ b/admin/dashboard/templates/index.html @@ -816,6 +816,9 @@ ]; }, buildAiRuntimeServiceBlocks(aiRuntime) { + // LLM 运行态原先拆成 3 张子卡片,视觉高度会明显超过基础设施里的 MySQL / Redis 两张卡片。 + // 这里改成 2 张:第一张保留整体质量指标,第二张合并“路由配置 + 最近调用”, + // 这样首页信息密度不变,但版面层级更统一。 return [ { key: 'ai-overview', @@ -861,10 +864,14 @@ ] }, { - key: 'ai-routing', - title: '路由配置', - status: aiRuntime.has_routing ? 'healthy' : 'warning', - summary: aiRuntime.default_scene ? `默认场景:${aiRuntime.default_scene}` : '当前未设置默认场景', + key: 'ai-routing-last-call', + title: '路由与最近调用', + status: aiRuntime.has_routing + ? ((aiRuntime.total_calls || 0) > 0 ? 'healthy' : 'warning') + : 'warning', + summary: aiRuntime.last_timestamp + ? `最近调用时间:${aiRuntime.last_timestamp}` + : (aiRuntime.default_scene ? `默认场景:${aiRuntime.default_scene}` : '当前未设置默认场景'), highlights: [ { label: '默认场景', @@ -875,35 +882,11 @@ label: '默认后端', value: aiRuntime.default_backend || '-', tone: aiRuntime.default_backend ? 'healthy' : 'warning' - } - ], - metrics: [ - { label: '场景数量', value: this.formatMetricNumber(aiRuntime.scene_count) }, - { label: '目标数量', value: this.formatMetricNumber(aiRuntime.target_count) }, - { label: 'Provider 模板', value: this.formatMetricNumber(aiRuntime.provider_count) }, - { label: '默认后端', value: aiRuntime.default_backend || '-' } - ] - }, - { - key: 'ai-last-call', - title: '最近调用', - status: (aiRuntime.failed_calls || 0) > 0 ? 'warning' : ((aiRuntime.total_calls || 0) > 0 ? 'healthy' : 'warning'), - summary: aiRuntime.last_timestamp ? `最近一次记录时间:${aiRuntime.last_timestamp}` : '当前窗口内暂无调用记录', - highlights: [ - { - label: 'Provider', - value: aiRuntime.last_provider || '-', - tone: 'neutral' }, { - label: 'Backend', - value: aiRuntime.last_backend || '-', - tone: 'neutral' - }, - { - label: 'Scene', + label: '最近场景', value: aiRuntime.last_scene || '-', - tone: 'neutral' + tone: aiRuntime.last_scene ? 'info' : 'neutral' } ], meters: [ @@ -915,6 +898,11 @@ ) ], metrics: [ + { label: '场景数量', value: this.formatMetricNumber(aiRuntime.scene_count) }, + { label: '目标数量', value: this.formatMetricNumber(aiRuntime.target_count) }, + { label: 'Provider 模板', value: this.formatMetricNumber(aiRuntime.provider_count) }, + { label: '最近 Provider', value: aiRuntime.last_provider || '-' }, + { label: '最近后端', value: aiRuntime.last_backend || '-' }, { label: '模型', value: aiRuntime.last_model || '-' }, { label: '最近错误', value: aiRuntime.last_error || '无' } ] @@ -925,6 +913,8 @@ return `最近调用 ${aiRuntime.total_calls || 0} 次,失败 ${aiRuntime.failed_calls || 0} 次,平均耗时 ${this.formatMetricNumber(aiRuntime.avg_latency_ms, 2)} ms`; }, buildSchedulerServiceBlocks(scheduler) { + // 任务调度也从 3 张子卡片压缩成 2 张,避免它在首页右侧比基础设施区块显得“更重”。 + // 处理方式是把“失败与恢复”合并进“执行状态”,把运维最关注的信息集中在一张卡片里。 return [ { key: 'scheduler-overview', @@ -964,10 +954,14 @@ ] }, { - key: 'scheduler-runtime', - title: '执行状态', - status: scheduler.status || 'warning', - summary: scheduler.latest_failed_job_name ? `最近失败任务:${scheduler.latest_failed_job_name}` : '当前未发现最近失败任务', + key: 'scheduler-runtime-alert', + title: '执行与告警', + status: scheduler.latest_failed_error + ? 'warning' + : (scheduler.invalid_jobs > 0 ? 'danger' : (scheduler.status || 'warning')), + summary: scheduler.latest_failed_error + ? `最近失败原因:${scheduler.latest_failed_error}` + : (scheduler.latest_failed_job_name ? `最近失败任务:${scheduler.latest_failed_job_name}` : '当前未发现最近失败任务'), highlights: [ { label: '执行中', @@ -983,6 +977,11 @@ label: '非法调度', value: this.formatMetricNumber(scheduler.invalid_jobs), tone: Number(scheduler.invalid_jobs || 0) > 0 ? 'danger' : 'healthy' + }, + { + label: '最近失败任务', + value: scheduler.latest_failed_job_name || '无', + tone: scheduler.latest_failed_job_name ? 'warning' : 'healthy' } ], meters: [ @@ -1000,33 +999,12 @@ ) ], metrics: [ - { label: '执行中', value: this.formatMetricNumber(scheduler.running_jobs) }, { label: '失败任务', value: this.formatMetricNumber(scheduler.failed_jobs) }, - { label: '非法调度', value: this.formatMetricNumber(scheduler.invalid_jobs) }, - { label: '未执行过', value: this.formatMetricNumber(scheduler.never_run_jobs) } - ] - }, - { - key: 'scheduler-last-failure', - title: '失败与恢复', - status: scheduler.latest_failed_error ? 'warning' : (scheduler.status || 'healthy'), - summary: scheduler.latest_failed_error ? '当前存在最近失败原因摘要' : '最近未记录到失败原因', - highlights: [ - { - label: '最近失败任务', - value: scheduler.latest_failed_job_name || '无', - tone: scheduler.latest_failed_job_name ? 'warning' : 'healthy' - }, - { - label: '最近失败原因', - value: scheduler.latest_failed_error || '无', - tone: scheduler.latest_failed_error ? 'warning' : 'healthy' - } - ], - metrics: [ + { label: '未执行过', value: this.formatMetricNumber(scheduler.never_run_jobs) }, { label: '下次执行', value: scheduler.next_run_at || '-' }, { label: '系统任务', value: this.formatMetricNumber(scheduler.system_job_count) }, - { label: '插件任务', value: this.formatMetricNumber(scheduler.plugin_job_count) } + { label: '插件任务', value: this.formatMetricNumber(scheduler.plugin_job_count) }, + { label: '最近失败原因', value: scheduler.latest_failed_error || '无' } ] } ];