feat: 自动提交 - 周二 2025/09/23 14:03:10.47

This commit is contained in:
赵杰
2025-09-23 14:03:10 +01:00
parent 4da97d600a
commit 6b0c03439f
8 changed files with 104 additions and 65 deletions

View File

@@ -19,6 +19,10 @@ const translations = {
'sidebar-knowledge': '知识库',
'sidebar-analytics': '数据分析',
'sidebar-feishu-sync': '飞书同步',
'sidebar-conversation-history': '对话历史',
'sidebar-token-monitor': 'Token监控',
'sidebar-ai-monitor': 'AI监控',
'sidebar-system-optimizer': '系统优化',
'sidebar-system': '系统设置',
// 预警管理页面
@@ -60,6 +64,10 @@ const translations = {
'sidebar-knowledge': 'Knowledge Base',
'sidebar-analytics': 'Analytics',
'sidebar-feishu-sync': 'Feishu Sync',
'sidebar-conversation-history': 'Conversation History',
'sidebar-token-monitor': 'Token Monitor',
'sidebar-ai-monitor': 'AI Monitor',
'sidebar-system-optimizer': 'System Optimizer',
'sidebar-system': 'System Settings',
// Alert Management page
@@ -109,7 +117,19 @@ function updatePageLanguage(lang) {
elements.forEach(element => {
const key = element.getAttribute('data-i18n');
if (t[key]) {
element.textContent = t[key];
// 检查元素是否包含图标i标签
const icon = element.querySelector('i');
if (icon) {
// 如果包含图标,只更新文本部分
const textNodes = Array.from(element.childNodes).filter(node =>
node.nodeType === Node.TEXT_NODE || (node.nodeType === Node.ELEMENT_NODE && node.tagName !== 'I')
);
// 保留图标,更新其他文本内容
element.innerHTML = icon.outerHTML + ' ' + t[key];
} else {
// 如果没有图标,直接更新文本内容
element.textContent = t[key];
}
}
});
@@ -129,7 +149,13 @@ function updatePageLanguage(lang) {
if (currentTab) {
const tabKey = currentTab.getAttribute('data-i18n');
if (tabKey && t[tabKey]) {
currentTabTitle.textContent = t[tabKey];
// 检查当前标签是否包含图标
const icon = currentTab.querySelector('i');
if (icon) {
currentTabTitle.innerHTML = icon.outerHTML + ' ' + t[tabKey];
} else {
currentTabTitle.textContent = t[tabKey];
}
}
}
}
@@ -194,7 +220,7 @@ class TSPDashboard {
if (data.success) {
if (textarea) {
textarea.value = data.ai_suggestion || '';
textarea.value = data.suggestion || '';
textarea.classList.remove('ai-loading');
textarea.classList.add('success-animation');
@@ -703,15 +729,15 @@ class TSPDashboard {
}
startAutoRefresh() {
// 每15秒刷新健康状态(减少 /api/health 日志
// 每30秒刷新健康状态(减少重复请求
this.refreshIntervals.health = setInterval(() => {
this.loadHealth();
}, 15000);
}, 30000);
// 每10秒刷新当前标签页数据
// 每30秒刷新当前标签页数据(减少重复请求)
this.refreshIntervals.currentTab = setInterval(() => {
this.refreshCurrentTab();
}, 10000);
}, 30000);
}
refreshCurrentTab() {
@@ -815,8 +841,8 @@ class TSPDashboard {
// 更新统计卡片
document.getElementById('total-sessions').textContent = sessions.sessions?.length || 0;
document.getElementById('total-alerts').textContent = alerts.length || 0;
document.getElementById('total-workorders').textContent = workorders.filter(w => w.status === 'open').length || 0;
document.getElementById('total-alerts').textContent = alerts.alerts?.length || 0;
document.getElementById('total-workorders').textContent = workorders.workorders?.filter(w => w.status === 'open').length || 0;
document.getElementById('knowledge-count').textContent = knowledge.total_entries || 0;
// 更新知识库详细统计
@@ -832,6 +858,9 @@ class TSPDashboard {
// 更新系统健康状态
await this.updateSystemHealth();
// 加载分析数据并更新统计卡片
await this.loadAnalytics();
} catch (error) {
console.error('加载仪表板数据失败:', error);
@@ -3782,11 +3811,13 @@ class TSPDashboard {
// 更新工单统计
const total = data.workorders?.total || 0;
const open = data.workorders?.open || 0;
const inProgress = data.workorders?.in_progress || 0;
const resolved = data.workorders?.resolved || 0;
const avgSatisfaction = data.satisfaction?.average || 0;
document.getElementById('totalWorkorders').textContent = total;
document.getElementById('openWorkorders').textContent = open;
document.getElementById('workorders-progress').textContent = inProgress;
document.getElementById('resolvedWorkorders').textContent = resolved;
document.getElementById('avgSatisfaction').textContent = avgSatisfaction.toFixed(1);