mirror of
https://github.com/Minidoracat/mcp-feedback-enhanced.git
synced 2025-07-27 10:42:25 +08:00
🐛 修復會話管理的會話數量跟統計的計算
This commit is contained in:
parent
cfdc192b1e
commit
75d8e1f35c
@ -38,6 +38,9 @@
|
|||||||
this.onHistoryChange = options.onHistoryChange || null;
|
this.onHistoryChange = options.onHistoryChange || null;
|
||||||
this.onStatsChange = options.onStatsChange || null;
|
this.onStatsChange = options.onStatsChange || null;
|
||||||
|
|
||||||
|
// 初始化統計資訊
|
||||||
|
this.updateStats();
|
||||||
|
|
||||||
console.log('📊 SessionDataManager 初始化完成');
|
console.log('📊 SessionDataManager 初始化完成');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,21 +349,35 @@
|
|||||||
*/
|
*/
|
||||||
SessionUIRenderer.prototype.renderStats = function(stats) {
|
SessionUIRenderer.prototype.renderStats = function(stats) {
|
||||||
console.log('🎨 渲染統計資訊:', stats);
|
console.log('🎨 渲染統計資訊:', stats);
|
||||||
|
console.log('🎨 統計元素狀態:', {
|
||||||
|
todayCount: !!this.statsElements.todayCount,
|
||||||
|
averageDuration: !!this.statsElements.averageDuration,
|
||||||
|
totalSessions: !!this.statsElements.totalSessions
|
||||||
|
});
|
||||||
|
|
||||||
// 更新今日會話數
|
// 更新今日會話數
|
||||||
if (this.statsElements.todayCount) {
|
if (this.statsElements.todayCount) {
|
||||||
DOMUtils.safeSetTextContent(this.statsElements.todayCount, stats.todayCount.toString());
|
DOMUtils.safeSetTextContent(this.statsElements.todayCount, stats.todayCount.toString());
|
||||||
|
console.log('🎨 已更新今日會話數:', stats.todayCount);
|
||||||
|
} else {
|
||||||
|
console.warn('🎨 找不到今日會話數元素 (.stat-today-count)');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新平均時長
|
// 更新平均時長
|
||||||
if (this.statsElements.averageDuration) {
|
if (this.statsElements.averageDuration) {
|
||||||
const durationText = TimeUtils.formatDuration(stats.averageDuration);
|
const durationText = TimeUtils.formatDuration(stats.averageDuration);
|
||||||
DOMUtils.safeSetTextContent(this.statsElements.averageDuration, durationText);
|
DOMUtils.safeSetTextContent(this.statsElements.averageDuration, durationText);
|
||||||
|
console.log('🎨 已更新平均時長:', durationText);
|
||||||
|
} else {
|
||||||
|
console.warn('🎨 找不到平均時長元素 (.stat-average-duration)');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新總會話數
|
// 更新總會話數
|
||||||
if (this.statsElements.totalSessions) {
|
if (this.statsElements.totalSessions) {
|
||||||
DOMUtils.safeSetTextContent(this.statsElements.totalSessions, stats.totalSessions.toString());
|
DOMUtils.safeSetTextContent(this.statsElements.totalSessions, stats.totalSessions.toString());
|
||||||
|
console.log('🎨 已更新總會話數:', stats.totalSessions);
|
||||||
|
} else {
|
||||||
|
console.warn('🎨 找不到總會話數元素 (.stat-total-sessions)');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -475,11 +475,11 @@
|
|||||||
<h4 data-i18n="sessionManagement.statistics">統計資訊</h4>
|
<h4 data-i18n="sessionManagement.statistics">統計資訊</h4>
|
||||||
<div class="stats-grid">
|
<div class="stats-grid">
|
||||||
<div class="stat-item">
|
<div class="stat-item">
|
||||||
<div class="stat-value">0</div>
|
<div class="stat-value stat-today-count">0</div>
|
||||||
<div class="stat-label" data-i18n="sessionManagement.todaySessions">今日會話</div>
|
<div class="stat-label" data-i18n="sessionManagement.todaySessions">今日會話</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-item">
|
<div class="stat-item">
|
||||||
<div class="stat-value">--</div>
|
<div class="stat-value stat-average-duration">--</div>
|
||||||
<div class="stat-label" data-i18n="sessionManagement.averageDuration">平均時長</div>
|
<div class="stat-label" data-i18n="sessionManagement.averageDuration">平均時長</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user