Skip to content

Commit fea1f73

Browse files
committed
修复我的站点分模型 Token 图排序错乱 (v2.0.3)
byModel 按消费(cost)降序返回(v1 口径,模型明细表沿用),但该图纵轴是 tokens:v1 的手绘列表画法对顺序不敏感(每行自带名字+数值文本),v2 换成 G2 数值轴条形图后,cost 序 + token 跨 4000 倍 → 巨柱夹在中间、长尾全是 隐形细条,top10 折叠还会按错误顺序吞掉高 token 模型。图表输入改为按 tokens 降序重排后再折叠;用量统计页本就排序(与 v1 同源)不受影响。
1 parent ce5a3bc commit fea1f73

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

app/(dashboard)/my/page.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,10 @@ export default function MyStationPage() {
385385

386386
const pctCol = (cost: number) => (totCost > 0 ? ((cost / totCost) * 100).toFixed(1) + "%" : "—");
387387

388-
const modelItems = top10(models, "model");
388+
// byModel 按消费(cost)降序(v1 口径,模型明细表沿用);本图纵轴是 tokens,
389+
// 必须按 tokens 重排——否则巨量 token 的便宜模型排在中间、长尾全是隐形细条,
390+
// top10 折叠也会按错误顺序吞掉高 token 模型
391+
const modelItems = top10([...models].sort((a, b) => (b.tokens || 0) - (a.tokens || 0)), "model");
389392
const userItems = top10(users, "user");
390393

391394
return (

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "relay-monitor",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"private": true,
55
"license": "MIT",
66
"type": "module",

0 commit comments

Comments
 (0)