diff --git a/web/static/css/style.css b/web/static/css/style.css index d03c4c3c..ff5738d4 100644 --- a/web/static/css/style.css +++ b/web/static/css/style.css @@ -8598,6 +8598,8 @@ header { } .dashboard-tools-chart-wrap { + display: flex; + flex-direction: column; min-width: 0; flex: 1; } @@ -8607,6 +8609,7 @@ header { align-items: center; justify-content: center; min-height: 120px; + flex: 1; font-size: 0.8125rem; color: var(--text-muted); background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%); diff --git a/web/static/js/dashboard.js b/web/static/js/dashboard.js index 8e70968c..edf17fb1 100644 --- a/web/static/js/dashboard.js +++ b/web/static/js/dashboard.js @@ -17,7 +17,7 @@ async function refreshDashboard() { setEl('dashboard-kpi-tools-calls', '…'); setEl('dashboard-kpi-success-rate', '…'); var chartPlaceholder = document.getElementById('dashboard-tools-pie-placeholder'); - if (chartPlaceholder) { chartPlaceholder.style.display = 'block'; chartPlaceholder.textContent = '加载中…'; } + if (chartPlaceholder) { chartPlaceholder.style.removeProperty('display'); chartPlaceholder.textContent = '加载中…'; } var barChartEl = document.getElementById('dashboard-tools-bar-chart'); if (barChartEl) { barChartEl.style.display = 'none'; barChartEl.innerHTML = ''; } @@ -134,19 +134,31 @@ async function refreshDashboard() { // 知识:{ enabled, total_categories, total_items, ... }(优化版) const knowledgeItemsEl = document.getElementById('dashboard-knowledge-items'); const knowledgeCategoriesEl = document.getElementById('dashboard-knowledge-categories'); + const knowledgeStatusEl = document.getElementById('dashboard-knowledge-status'); if (knowledgeRes && typeof knowledgeRes === 'object') { if (knowledgeRes.enabled === false) { - if (knowledgeItemsEl) knowledgeItemsEl.textContent = '未启用'; + // 功能未启用:用状态标签展示,数值保持为 "-" + if (knowledgeStatusEl) knowledgeStatusEl.textContent = '未启用'; + if (knowledgeItemsEl) knowledgeItemsEl.textContent = '-'; if (knowledgeCategoriesEl) knowledgeCategoriesEl.textContent = '-'; } else { const categories = knowledgeRes.total_categories ?? 0; const items = knowledgeRes.total_items ?? 0; if (knowledgeItemsEl) knowledgeItemsEl.textContent = formatNumber(items); if (knowledgeCategoriesEl) knowledgeCategoriesEl.textContent = formatNumber(categories); + // 根据数据量给个轻量状态文案 + if (knowledgeStatusEl) { + if (items > 0 || categories > 0) { + knowledgeStatusEl.textContent = '已启用'; + } else { + knowledgeStatusEl.textContent = '待配置'; + } + } } } else { if (knowledgeItemsEl) knowledgeItemsEl.textContent = '-'; if (knowledgeCategoriesEl) knowledgeCategoriesEl.textContent = '-'; + if (knowledgeStatusEl) knowledgeStatusEl.textContent = '-'; } // Skills:{ total_skills, total_calls, ... }(优化版) @@ -188,7 +200,7 @@ async function refreshDashboard() { setEl('dashboard-kpi-tools-calls', '-'); renderDashboardToolsBar(null); var ph = document.getElementById('dashboard-tools-pie-placeholder'); - if (ph) { ph.style.display = 'block'; ph.textContent = '暂无调用数据'; } + if (ph) { ph.style.removeProperty('display'); ph.textContent = '暂无调用数据'; } } } @@ -201,7 +213,7 @@ function setDashboardOverviewPlaceholder(t) { ['dashboard-batch-pending', 'dashboard-batch-running', 'dashboard-batch-done', 'dashboard-batch-total', 'dashboard-tools-count', 'dashboard-tools-calls', 'dashboard-tools-success-rate', 'dashboard-skills-count', 'dashboard-skills-calls', 'dashboard-skills-status', - 'dashboard-knowledge-items', 'dashboard-knowledge-categories'].forEach(id => setEl(id, t)); + 'dashboard-knowledge-items', 'dashboard-knowledge-categories', 'dashboard-knowledge-status'].forEach(id => setEl(id, t)); updateProgressBar('dashboard-batch-progress-pending', '0'); updateProgressBar('dashboard-batch-progress-running', '0'); updateProgressBar('dashboard-batch-progress-done', '0'); @@ -244,7 +256,8 @@ function renderDashboardToolsBar(monitorRes) { if (!placeholder || !barChartEl) return; if (!monitorRes || typeof monitorRes !== 'object') { - placeholder.style.display = 'block'; + placeholder.style.removeProperty('display'); + placeholder.textContent = '暂无调用数据'; barChartEl.style.display = 'none'; barChartEl.innerHTML = ''; return; @@ -259,7 +272,8 @@ function renderDashboardToolsBar(monitorRes) { .slice(0, 30); if (entries.length === 0) { - placeholder.style.display = 'block'; + placeholder.style.removeProperty('display'); + placeholder.textContent = '暂无调用数据'; barChartEl.style.display = 'none'; barChartEl.innerHTML = ''; return; diff --git a/web/templates/index.html b/web/templates/index.html index c9eb526c..d1969d67 100644 --- a/web/templates/index.html +++ b/web/templates/index.html @@ -299,6 +299,7 @@