@@ -131,7 +131,7 @@
|
||||
<div class="section-heading section-heading--stack">
|
||||
<div>
|
||||
<h3>系统健康快照</h3>
|
||||
<p>把连接状态、插件运行、异常数量、LLM 运行态与任务调度集中到一个面板里。</p>
|
||||
<p>把连接状态、插件运行、异常数量与转图运行时集中到一个面板里。</p>
|
||||
</div>
|
||||
<div class="health-overview-meta">
|
||||
<span class="health-overview-meta__label">最近刷新</span>
|
||||
@@ -394,38 +394,15 @@
|
||||
status: 'warning',
|
||||
total_calls: 0,
|
||||
failed_calls: 0,
|
||||
success_rate: 0,
|
||||
avg_latency_ms: 0,
|
||||
summary: '加载中...',
|
||||
last_call: {},
|
||||
scene_count: 0,
|
||||
target_count: 0,
|
||||
provider_count: 0,
|
||||
has_routing: false,
|
||||
default_scene: '',
|
||||
default_backend: '',
|
||||
last_provider: '',
|
||||
last_backend: '',
|
||||
last_scene: '',
|
||||
last_model: '',
|
||||
last_timestamp: '',
|
||||
last_latency_ms: 0,
|
||||
last_error: ''
|
||||
last_call: {}
|
||||
},
|
||||
scheduler: {
|
||||
md2img: {
|
||||
status: 'warning',
|
||||
total_jobs: 0,
|
||||
enabled_jobs: 0,
|
||||
running_jobs: 0,
|
||||
failed_jobs: 0,
|
||||
invalid_jobs: 0,
|
||||
paused_jobs: 0,
|
||||
never_run_jobs: 0,
|
||||
system_job_count: 0,
|
||||
plugin_job_count: 0,
|
||||
next_run_at: '',
|
||||
latest_failed_job_name: '',
|
||||
latest_failed_error: '',
|
||||
healthy: false,
|
||||
runtime_ready: false,
|
||||
browser_ready: false,
|
||||
summary: '加载中...'
|
||||
}
|
||||
},
|
||||
@@ -469,7 +446,7 @@
|
||||
const errors = this.healthSummary.errors || {};
|
||||
const infrastructure = this.healthSummary.infrastructure || {};
|
||||
const aiRuntime = this.healthSummary.ai_runtime || {};
|
||||
const scheduler = this.healthSummary.scheduler || {};
|
||||
const md2img = this.healthSummary.md2img || {};
|
||||
return [
|
||||
{
|
||||
key: 'robot',
|
||||
@@ -506,23 +483,19 @@
|
||||
},
|
||||
{
|
||||
key: 'ai_runtime',
|
||||
title: 'LLM 运行态',
|
||||
title: 'AI 运行态',
|
||||
status: aiRuntime.status || 'warning',
|
||||
value: (aiRuntime.total_calls || 0) > 0
|
||||
? `${this.formatMetricNumber(aiRuntime.success_rate, 2)}%`
|
||||
: `${aiRuntime.scene_count || 0} 个场景`,
|
||||
value: `${aiRuntime.avg_latency_ms || 0} ms`,
|
||||
summary: aiRuntime.summary || '暂无状态',
|
||||
serviceBlocks: this.buildAiRuntimeServiceBlocks(aiRuntime),
|
||||
extra: this.buildAiRuntimeExtra(aiRuntime)
|
||||
extra: `最近调用 ${aiRuntime.total_calls || 0} 次,失败 ${aiRuntime.failed_calls || 0} 次`
|
||||
},
|
||||
{
|
||||
key: 'scheduler',
|
||||
title: '任务调度',
|
||||
status: scheduler.status || 'warning',
|
||||
value: `${scheduler.enabled_jobs || 0} / ${scheduler.total_jobs || 0}`,
|
||||
summary: scheduler.summary || '暂无状态',
|
||||
serviceBlocks: this.buildSchedulerServiceBlocks(scheduler),
|
||||
extra: this.buildSchedulerExtra(scheduler)
|
||||
key: 'md2img',
|
||||
title: 'Markdown 转图',
|
||||
status: md2img.status || 'warning',
|
||||
value: md2img.healthy ? '就绪' : '待检查',
|
||||
summary: md2img.summary || '暂无状态',
|
||||
extra: `Runtime ${md2img.runtime_ready ? '已就绪' : '未就绪'} / Browser ${md2img.browser_ready ? '已就绪' : '未就绪'}`
|
||||
}
|
||||
];
|
||||
}
|
||||
@@ -684,141 +657,6 @@
|
||||
}
|
||||
];
|
||||
},
|
||||
buildAiRuntimeServiceBlocks(aiRuntime) {
|
||||
// AI 卡片拆成“路由配置”和“最近调用”两个子面板,
|
||||
// 让首页既能判断配置是否完整,也能快速定位最近请求到底走了哪条链路。
|
||||
return [
|
||||
{
|
||||
key: 'ai-routing',
|
||||
title: '路由配置',
|
||||
status: aiRuntime.has_routing ? 'healthy' : 'warning',
|
||||
summary: aiRuntime.default_scene
|
||||
? `默认场景:${aiRuntime.default_scene}`
|
||||
: '当前未设置默认场景',
|
||||
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}`
|
||||
: '当前窗口内暂无调用记录',
|
||||
metrics: [
|
||||
{
|
||||
label: 'Provider',
|
||||
value: aiRuntime.last_provider || '-'
|
||||
},
|
||||
{
|
||||
label: 'Backend',
|
||||
value: aiRuntime.last_backend || '-'
|
||||
},
|
||||
{
|
||||
label: 'Scene',
|
||||
value: aiRuntime.last_scene || '-'
|
||||
},
|
||||
{
|
||||
label: '模型',
|
||||
value: aiRuntime.last_model || '-'
|
||||
},
|
||||
{
|
||||
label: '最近耗时',
|
||||
value: `${this.formatMetricNumber(aiRuntime.last_latency_ms, 2)} ms`
|
||||
},
|
||||
{
|
||||
label: '最近错误',
|
||||
value: aiRuntime.last_error || '无'
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
},
|
||||
buildAiRuntimeExtra(aiRuntime) {
|
||||
return `最近调用 ${aiRuntime.total_calls || 0} 次,失败 ${aiRuntime.failed_calls || 0} 次,平均耗时 ${this.formatMetricNumber(aiRuntime.avg_latency_ms, 2)} ms`;
|
||||
},
|
||||
buildSchedulerServiceBlocks(scheduler) {
|
||||
// 任务调度卡片只保留首页最需要的摘要:
|
||||
// 任务装载量、执行态、失败数,以及系统任务/插件任务的大致构成。
|
||||
return [
|
||||
{
|
||||
key: 'scheduler-overview',
|
||||
title: '任务装载',
|
||||
status: scheduler.enabled_jobs > 0 ? 'healthy' : 'warning',
|
||||
summary: scheduler.next_run_at
|
||||
? `下一次执行:${scheduler.next_run_at}`
|
||||
: '当前没有可计算的下一次执行时间',
|
||||
metrics: [
|
||||
{
|
||||
label: '启用任务',
|
||||
value: this.formatMetricNumber(scheduler.enabled_jobs)
|
||||
},
|
||||
{
|
||||
label: '暂停任务',
|
||||
value: this.formatMetricNumber(scheduler.paused_jobs)
|
||||
},
|
||||
{
|
||||
label: '系统任务',
|
||||
value: this.formatMetricNumber(scheduler.system_job_count)
|
||||
},
|
||||
{
|
||||
label: '插件任务',
|
||||
value: this.formatMetricNumber(scheduler.plugin_job_count)
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: 'scheduler-runtime',
|
||||
title: '执行状态',
|
||||
status: scheduler.status || 'warning',
|
||||
summary: scheduler.latest_failed_job_name
|
||||
? `最近失败任务:${scheduler.latest_failed_job_name}`
|
||||
: '当前未发现最近失败任务',
|
||||
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)
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
},
|
||||
buildSchedulerExtra(scheduler) {
|
||||
if (scheduler.latest_failed_error) {
|
||||
return `最近失败原因:${scheduler.latest_failed_error}`;
|
||||
}
|
||||
return scheduler.next_run_at
|
||||
? `下次执行时间:${scheduler.next_run_at}`
|
||||
: '当前暂无可用的下一次执行时间';
|
||||
},
|
||||
renderPieChart(chartId, usageValue, label) {
|
||||
const ctx = document.getElementById(chartId);
|
||||
if (!ctx) return;
|
||||
|
||||
Reference in New Issue
Block a user