Fix/usage transfer filter (#307)

* fix(usage): 恢复 usage 列表中的 fallback 路由信号

* fix(admin): 支持 usage 记录展示和筛选 fallback 转移

* fix(usage): 在用户 usage 记录中暴露 fallback 标记

* fix(usage): 共享 usage 页面支持 fallback 筛选

* fix(usage): 对齐 fallback 筛选相关前端类型

* fix(usage): propagate has_fallback through active polling

---------

Co-authored-by: fawney19 <elky0401@gmail.com>
This commit is contained in:
RWDai
2026-04-17 13:38:23 +08:00
committed by GitHub
parent 654a41c3b0
commit ff4e853fd3
15 changed files with 298 additions and 49 deletions

View File

@@ -4795,6 +4795,7 @@ async fn gateway_handles_users_me_usage_locally_without_proxying_upstream() {
"streaming",
now - chrono::Duration::minutes(5),
);
streaming_usage.candidate_index = Some(2);
streaming_usage.request_metadata = Some(json!({
"rate_multiplier": 0.5,
"input_price_per_1m": 3.0,
@@ -4886,6 +4887,7 @@ async fn gateway_handles_users_me_usage_locally_without_proxying_upstream() {
assert_eq!(payload["records"][0]["output_price_per_1m"], 9.0);
assert_eq!(payload["records"][0]["cache_creation_price_per_1m"], 3.75);
assert_eq!(payload["records"][0]["cache_read_price_per_1m"], 0.3);
assert_eq!(payload["records"][0]["has_fallback"], true);
assert_eq!(payload["records"][0]["api_key"]["name"], "renamed-key");
assert_eq!(payload["records"][0]["api_key"]["display"], "renamed-key");
assert_eq!(