压缩首页LLM与任务调度子卡片布局

This commit is contained in:
liuwei
2026-05-06 09:25:43 +08:00
parent 96cd61bf5d
commit d036de3138

View File

@@ -816,6 +816,9 @@
]; ];
}, },
buildAiRuntimeServiceBlocks(aiRuntime) { buildAiRuntimeServiceBlocks(aiRuntime) {
// LLM 运行态原先拆成 3 张子卡片,视觉高度会明显超过基础设施里的 MySQL / Redis 两张卡片。
// 这里改成 2 张:第一张保留整体质量指标,第二张合并“路由配置 + 最近调用”,
// 这样首页信息密度不变,但版面层级更统一。
return [ return [
{ {
key: 'ai-overview', key: 'ai-overview',
@@ -861,10 +864,14 @@
] ]
}, },
{ {
key: 'ai-routing', key: 'ai-routing-last-call',
title: '路由配置', title: '路由与最近调用',
status: aiRuntime.has_routing ? 'healthy' : 'warning', status: aiRuntime.has_routing
summary: aiRuntime.default_scene ? `默认场景:${aiRuntime.default_scene}` : '当前未设置默认场景', ? ((aiRuntime.total_calls || 0) > 0 ? 'healthy' : 'warning')
: 'warning',
summary: aiRuntime.last_timestamp
? `最近调用时间:${aiRuntime.last_timestamp}`
: (aiRuntime.default_scene ? `默认场景:${aiRuntime.default_scene}` : '当前未设置默认场景'),
highlights: [ highlights: [
{ {
label: '默认场景', label: '默认场景',
@@ -875,35 +882,11 @@
label: '默认后端', label: '默认后端',
value: aiRuntime.default_backend || '-', value: aiRuntime.default_backend || '-',
tone: aiRuntime.default_backend ? 'healthy' : 'warning' 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', label: '最近场景',
value: aiRuntime.last_backend || '-',
tone: 'neutral'
},
{
label: 'Scene',
value: aiRuntime.last_scene || '-', value: aiRuntime.last_scene || '-',
tone: 'neutral' tone: aiRuntime.last_scene ? 'info' : 'neutral'
} }
], ],
meters: [ meters: [
@@ -915,6 +898,11 @@
) )
], ],
metrics: [ 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_model || '-' },
{ label: '最近错误', value: aiRuntime.last_error || '无' } { 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`; return `最近调用 ${aiRuntime.total_calls || 0} 次,失败 ${aiRuntime.failed_calls || 0} 次,平均耗时 ${this.formatMetricNumber(aiRuntime.avg_latency_ms, 2)} ms`;
}, },
buildSchedulerServiceBlocks(scheduler) { buildSchedulerServiceBlocks(scheduler) {
// 任务调度也从 3 张子卡片压缩成 2 张,避免它在首页右侧比基础设施区块显得“更重”。
// 处理方式是把“失败与恢复”合并进“执行状态”,把运维最关注的信息集中在一张卡片里。
return [ return [
{ {
key: 'scheduler-overview', key: 'scheduler-overview',
@@ -964,10 +954,14 @@
] ]
}, },
{ {
key: 'scheduler-runtime', key: 'scheduler-runtime-alert',
title: '执行状态', title: '执行与告警',
status: scheduler.status || 'warning', status: scheduler.latest_failed_error
summary: scheduler.latest_failed_job_name ? `最近失败任务:${scheduler.latest_failed_job_name}` : '当前未发现最近失败任务', ? '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: [ highlights: [
{ {
label: '执行中', label: '执行中',
@@ -983,6 +977,11 @@
label: '非法调度', label: '非法调度',
value: this.formatMetricNumber(scheduler.invalid_jobs), value: this.formatMetricNumber(scheduler.invalid_jobs),
tone: Number(scheduler.invalid_jobs || 0) > 0 ? 'danger' : 'healthy' 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: [ meters: [
@@ -1000,33 +999,12 @@
) )
], ],
metrics: [ metrics: [
{ label: '执行中', value: this.formatMetricNumber(scheduler.running_jobs) },
{ label: '失败任务', value: this.formatMetricNumber(scheduler.failed_jobs) }, { label: '失败任务', value: this.formatMetricNumber(scheduler.failed_jobs) },
{ label: '非法调度', value: this.formatMetricNumber(scheduler.invalid_jobs) }, { label: '未执行过', value: this.formatMetricNumber(scheduler.never_run_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: scheduler.next_run_at || '-' }, { label: '下次执行', value: scheduler.next_run_at || '-' },
{ label: '系统任务', value: this.formatMetricNumber(scheduler.system_job_count) }, { 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 || '无' }
] ]
} }
]; ];