fix: Token统计准确性修复 + 仪表盘增强

1. 修复eval_count只记最后一轮的bug:改为每轮累加
2. 新增prompt_eval_count(输入token)统计
3. 修复total_duration使用Ollama实际推理时间而非墙钟时间
4. 数据库messages表新增prompt_eval_count列(含兼容迁移)
5. 仪表盘显示输入/输出token分项统计
6. 柱状图堆叠显示输入(紫色)+输出(橙色)比例
7. 明细表格新增输入/输出/合计三列
This commit is contained in:
thzxx
2026-04-23 16:11:17 +08:00
parent e96b2a840e
commit 21b9a14824
8 changed files with 125 additions and 29 deletions
+49
View File
@@ -3516,6 +3516,13 @@ html, body {
font-weight: 500;
}
.td-stat-detail {
font-size: 10px;
color: var(--text-tertiary);
margin-top: 2px;
font-family: var(--font-mono);
}
/* 区块标题 */
.td-section {
margin-bottom: 20px;
@@ -3601,6 +3608,43 @@ html, body {
background: linear-gradient(180deg, #E8734A 0%, #F0976E 100%);
border-radius: 4px 4px 0 0;
transition: height 0.3s ease;
display: flex;
flex-direction: column-reverse;
}
.td-bar-input {
width: 100%;
background: linear-gradient(180deg, #9B7ED8 0%, #B99BE5 100%);
border-radius: 4px 4px 0 0;
min-height: 0;
}
.td-chart-legend {
display: flex;
gap: 16px;
margin-bottom: 10px;
font-size: 11px;
color: var(--text-secondary);
}
.td-legend-item {
display: flex;
align-items: center;
gap: 4px;
}
.td-legend-dot {
width: 10px;
height: 10px;
border-radius: 2px;
}
.td-legend-output {
background: #E8734A;
}
.td-legend-input {
background: #9B7ED8;
}
.td-bar-label {
@@ -3676,6 +3720,11 @@ html, body {
text-align: right;
}
.td-num-total {
font-weight: 700;
color: var(--accent);
}
.td-time {
font-size: 11px;
color: var(--text-secondary);