mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-05 00:47:48 +08:00
feat(dashboard): 增加全站实时指标和自动刷新
- 管理员仪表盘新增全站 RPM/TPM 与在线/启用用户指标 - 合并今日请求/费用、全站 RPM/TPM、在线/启用用户卡片展示 - 在线用户按最近 5 分钟活跃请求去重统计 - 全站 RPM/TPM 按最近 60 秒请求与 Token 统计 - 新增仪表盘自动刷新按钮,开启后每 10 秒静默刷新数据 - 同步前端类型、空态占位和仪表盘测试
This commit is contained in:
@@ -649,11 +649,24 @@ async fn gateway_handles_admin_dashboard_stats_locally_without_proxying_upstream
|
||||
assert_eq!(payload["today"]["tokens"], 17_450);
|
||||
assert_eq!(payload["today"]["cost"], json!(2.5));
|
||||
assert_eq!(payload["cost_stats"]["cost_savings"], json!(0.025));
|
||||
assert_eq!(payload["stats"][2]["subValue"], json!("节省 $0.01"));
|
||||
assert_eq!(payload["stats"][0]["value"], json!("2"));
|
||||
assert_eq!(payload["stats"][1]["value"], json!("17.4K"));
|
||||
let stats = payload["stats"].as_array().expect("stats should be array");
|
||||
assert_eq!(stats.len(), 4);
|
||||
let today_request_stats = stats
|
||||
.iter()
|
||||
.find(|item| item["name"] == json!("今日请求 / 费用"))
|
||||
.expect("today request stats card should exist");
|
||||
assert_eq!(today_request_stats["value"], json!("2 / $2.50"));
|
||||
assert_eq!(
|
||||
payload["stats"][1]["subValue"],
|
||||
today_request_stats["subValue"],
|
||||
json!("成功率 100.0% / 节省 $0.01")
|
||||
);
|
||||
let today_token_stats = stats
|
||||
.iter()
|
||||
.find(|item| item["name"] == json!("今日 Token"))
|
||||
.expect("today token stats card should exist");
|
||||
assert_eq!(today_token_stats["value"], json!("17.4K"));
|
||||
assert_eq!(
|
||||
today_token_stats["subValue"],
|
||||
json!("输入 12.1K / 输出 3.1K · 写缓存 1.25K / 读缓存 1K")
|
||||
);
|
||||
assert_eq!(payload["users"]["total"], 2);
|
||||
|
||||
Reference in New Issue
Block a user