fix: 保持仪表盘趋势图非负并纠正小时区间

- 小时粒度请求使用用户选择的起止时间,避免近24小时被截成整天
  - 修正日期展示格式化逻辑,减少时区偏移导致的窗口错位
  - 趋势图 Y 轴(Token/请求数/费用等)强制最小值为 0,防止出现负刻度
This commit is contained in:
atoz03
2025-12-04 17:05:36 +08:00
parent 4919e392a5
commit 95ef04c1a3
2 changed files with 25 additions and 81 deletions

View File

@@ -1036,6 +1036,7 @@ function createUsageTrendChart() {
type: 'linear',
display: true,
position: 'left',
min: 0,
title: {
display: true,
text: 'Token数量',
@@ -1055,6 +1056,7 @@ function createUsageTrendChart() {
type: 'linear',
display: true,
position: 'right',
min: 0,
title: {
display: true,
text: '请求数',
@@ -1073,7 +1075,8 @@ function createUsageTrendChart() {
y2: {
type: 'linear',
display: false, // 隐藏费用轴在tooltip中显示
position: 'right'
position: 'right',
min: 0
}
}
}
@@ -1253,6 +1256,7 @@ function createApiKeysUsageTrendChart() {
},
y: {
beginAtZero: true,
min: 0,
title: {
display: true,
text: apiKeysTrendMetric.value === 'tokens' ? 'Token 数量' : '请求次数',
@@ -1428,6 +1432,7 @@ function createAccountUsageTrendChart() {
},
y: {
beginAtZero: true,
min: 0,
title: {
display: true,
text: '消耗金额 (USD)',