mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 17:30:23 +08:00
fix(usage): 修正 input_tokens 统计与显示
- SQL 查询不再用 settlement snapshot 的 billing_input_tokens 覆盖原始 input_tokens - usage_mapper 针对 OpenAI 格式在 input_tokens 缺失时从 total_tokens - output_tokens 推导 - 前端轮询合并优先采用最新 record 的 input_tokens / effective_input_tokens
This commit is contained in:
@@ -425,8 +425,10 @@ export function useUsageData(options: UseUsageDataOptions) {
|
||||
// 保留本地的状态和所有通过轮询更新的字段
|
||||
status: mergedStatus,
|
||||
provider: protectProvider ? existing.provider : (record.provider || existing.provider),
|
||||
input_tokens: existing.input_tokens || record.input_tokens,
|
||||
effective_input_tokens: existing.effective_input_tokens ?? record.effective_input_tokens,
|
||||
input_tokens: Number.isFinite(record.input_tokens)
|
||||
? record.input_tokens
|
||||
: existing.input_tokens,
|
||||
effective_input_tokens: record.effective_input_tokens ?? existing.effective_input_tokens,
|
||||
output_tokens: existing.output_tokens || record.output_tokens,
|
||||
cache_creation_input_tokens: existing.cache_creation_input_tokens ?? record.cache_creation_input_tokens,
|
||||
cache_creation_ephemeral_5m_input_tokens:
|
||||
|
||||
Reference in New Issue
Block a user