fix(usage): 修复缓存创建 token 展示并在总量中计入缓存组件

- gateway/admin 用量载荷在 cache_creation_input_tokens 为 0 时回填 ephemeral_5m/1h 合计
- 标准化用量写入时将 cache_creation/cache_read token 计入 total_tokens
- 前端列表与轮询同步新增分类字段,修复缓存 token 列显示
This commit is contained in:
fawney19
2026-04-19 02:46:28 +08:00
parent e82c9c5104
commit 2f487fda66
11 changed files with 316 additions and 19 deletions

View File

@@ -391,6 +391,10 @@ async function pollActiveRequests() {
record.effective_input_tokens = update.effective_input_tokens ?? record.effective_input_tokens
record.output_tokens = update.output_tokens
record.cache_creation_input_tokens = update.cache_creation_input_tokens ?? undefined
record.cache_creation_ephemeral_5m_input_tokens =
update.cache_creation_ephemeral_5m_input_tokens ?? undefined
record.cache_creation_ephemeral_1h_input_tokens =
update.cache_creation_ephemeral_1h_input_tokens ?? undefined
record.cache_read_input_tokens = update.cache_read_input_tokens ?? undefined
record.cost = update.cost
record.actual_cost = update.actual_cost ?? undefined