diff --git a/web/static/i18n/en-US.json b/web/static/i18n/en-US.json index 59af7468..688a8966 100644 --- a/web/static/i18n/en-US.json +++ b/web/static/i18n/en-US.json @@ -91,10 +91,12 @@ "refresh": "Refresh", "refreshData": "Refresh data", "runningTasks": "Running tasks", + "runningConversations": "Running conversations", "vulnTotal": "Total vulnerabilities", "toolCalls": "Tool invocations", "successRate": "Tool success rate", "clickToViewTasks": "Click to view tasks", + "clickToViewChat": "Click to view conversations", "clickToViewVuln": "Click to view vulnerabilities", "clickToViewMCP": "Click to view MCP monitor", "accessOverviewTitle": "Access overview", diff --git a/web/static/i18n/zh-CN.json b/web/static/i18n/zh-CN.json index 79114c79..ca79e121 100644 --- a/web/static/i18n/zh-CN.json +++ b/web/static/i18n/zh-CN.json @@ -91,10 +91,12 @@ "refresh": "刷新", "refreshData": "刷新数据", "runningTasks": "运行中任务", + "runningConversations": "运行中对话", "vulnTotal": "漏洞总数", "toolCalls": "工具调用次数", "successRate": "工具执行成功率", "clickToViewTasks": "点击查看任务管理", + "clickToViewChat": "点击查看对话", "clickToViewVuln": "点击查看漏洞管理", "clickToViewMCP": "点击查看 MCP 监控", "accessOverviewTitle": "接入概览", diff --git a/web/static/js/dashboard.js b/web/static/js/dashboard.js index 44b96454..42f57e0f 100644 --- a/web/static/js/dashboard.js +++ b/web/static/js/dashboard.js @@ -1,4 +1,4 @@ -// 仪表盘页面:拉取运行中任务、漏洞统计、批量任务、工具与 Skills 统计并渲染。 +// 仪表盘页面:拉取运行中对话、漏洞统计、批量任务、工具与 Skills 统计并渲染。 // // 工程基础设施: // - dashboardState 集中保存运行时状态(in-flight controller / 自动轮询 timer / 上次更新时间 / @@ -150,36 +150,24 @@ async function refreshDashboard() { // 如果在 await 期间 controller 已被 abort,说明又有新刷新启动了,丢弃本次结果 if (signal && signal.aborted) return; - // 运行中任务:Agent 循环任务 + 批量队列「执行中」数量统一统计,避免顶部 KPI 与运行概览不一致 + // 运行中对话:仅统计 Agent 循环任务;批量队列见右侧「批量任务队列」 let agentRunningCount = null; if (tasksRes && Array.isArray(tasksRes.tasks)) { agentRunningCount = tasksRes.tasks.length; } let batchRunningCount = 0; - let batchPendingCount = 0; if (batchRes && Array.isArray(batchRes.queues)) { batchRes.queues.forEach(q => { const s = (q.status || '').toLowerCase(); if (s === 'running') batchRunningCount++; - else if (s === 'pending' || s === 'paused') batchPendingCount++; }); } - const totalRunning = (agentRunningCount || 0) + batchRunningCount; + const runningConversations = agentRunningCount !== null ? agentRunningCount : 0; if (runningEl) { - if (agentRunningCount !== null) { - runningEl.textContent = String(totalRunning); - } else if (batchRes && Array.isArray(batchRes.queues)) { - runningEl.textContent = String(batchRunningCount); - } else { - runningEl.textContent = '-'; - } + runningEl.textContent = agentRunningCount !== null ? String(agentRunningCount) : '-'; } - // KPI 副标:N 待执行 / 全部空闲 - if (batchPendingCount > 0) { - setKpiSubBadge('dashboard-kpi-tasks-sub-text', - dt('dashboard.pendingCountLabel', { count: batchPendingCount }, batchPendingCount + ' 待执行'), - 'pending'); - } else if (totalRunning === 0) { + // KPI 副标:全部空闲 / 正在执行 + if (runningConversations === 0) { setKpiSubBadge('dashboard-kpi-tasks-sub-text', dt('dashboard.allIdle', null, '系统空闲'), 'idle'); } else { setKpiSubBadge('dashboard-kpi-tasks-sub-text', dt('dashboard.executingNow', null, '正在执行'), 'running'); @@ -405,7 +393,7 @@ async function refreshDashboard() { var toolsConfiguredCount = (toolsConfigRes && typeof toolsConfigRes.total === 'number') ? toolsConfigRes.total : 0; updateSmartCTA({ - totalRunning: totalRunning, + totalRunning: runningConversations + batchRunningCount, totalVulns: (vulnRes && typeof vulnRes.total === 'number') ? vulnRes.total : 0, totalCalls: toolsTotalCalls, toolsConfigured: toolsConfiguredCount, @@ -421,7 +409,7 @@ async function refreshDashboard() { failedTools: toolsFailedCount, toolsConfigured: toolsConfiguredCount, totalVulns: (vulnRes && typeof vulnRes.total === 'number') ? vulnRes.total : 0, - totalRunning: totalRunning + totalRunning: runningConversations + batchRunningCount }); // 更新「上次更新」时间 diff --git a/web/templates/index.html b/web/templates/index.html index 0a8ba5c3..15424006 100644 --- a/web/templates/index.html +++ b/web/templates/index.html @@ -377,9 +377,9 @@