Refactor usage polling to paged APIs with legacy fallback#138
Conversation
3ff8db6 to
07aceca
Compare
0ae6c22 to
d3ddf09
Compare
1d3000d to
1e2f1ec
Compare
1e2f1ec to
522d7f1
Compare
522d7f1 to
9417d6d
Compare
|
@seakee could u please review? |
Thanks for the PR. The current PR does help alleviate the problems of slow loading, timeouts, and high frontend aggregation pressure on the request monitoring page under large data volumes. The subsequent refresh logic fix is also valuable, as it prevents the However, this PR affects the core data path of CPA-Manager request monitoring, so I’m not recommending merging it directly just yet. A few things still need to be addressed:
|
|
thanks for your review, I will fix them |
中文
变更内容
/v0/management/usage响应拆分为更小的接口请求:summary、accounts、api-keys 和 realtime。/v0/management/usage数据结构。end_ms被初次 render 固定的问题,避免总 tokens 和预估花费在第一次刷新后不再更新。useUsageData回归测试,覆盖 model prices 重新加载行为。验证
npm test -- --run src/features/monitoring/hooks/useUsageData.test.ts src/services/api/usageService.test.ts src/features/monitoring/hooks/useMonitoringData.test.ts src/features/monitoring/accountOverviewState.test.tsnpm run type-checknpm run lintnpm run buildend_ms,总 tokens 和预估花费会随新数据更新。English
Changes
/v0/management/usagepayload into smaller summary, accounts, api-keys, and realtime requests./v0/management/usagepayload shape.end_mswas frozen after the first render, which could keep total tokens and estimated cost unchanged after the first refresh.useUsageDataregression test for reloading model prices.Verification
npm test -- --run src/features/monitoring/hooks/useUsageData.test.ts src/services/api/usageService.test.ts src/features/monitoring/hooks/useMonitoringData.test.ts src/features/monitoring/accountOverviewState.test.tsnpm run type-checknpm run lintnpm run buildend_ms, and that total tokens and estimated cost update with new data.