mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-08 02:17:46 +08:00
fix(usage): 移动端缓存 token 拆分为读/写两列展示
cache_read 与 cache_creation 原本被合并为单值,现分别显示并补充测试
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { getCacheCreationTokens, getEffectiveInputTokens } from '../token-normalization'
|
||||
import { getCacheCreationTokens, getCacheReadTokens, getEffectiveInputTokens } from '../token-normalization'
|
||||
|
||||
describe('usage token normalization', () => {
|
||||
it('prefers explicit cache creation totals when present', () => {
|
||||
@@ -19,6 +19,20 @@ describe('usage token normalization', () => {
|
||||
})).toBe(20)
|
||||
})
|
||||
|
||||
it('keeps cache read and cache creation as separate display values', () => {
|
||||
const usage = {
|
||||
input_tokens: 1,
|
||||
cache_creation_input_tokens: 1530,
|
||||
cache_read_input_tokens: 104026,
|
||||
output_tokens: 591,
|
||||
api_format: 'claude:chat',
|
||||
}
|
||||
|
||||
expect(getEffectiveInputTokens(usage)).toBe(1)
|
||||
expect(getCacheReadTokens(usage)).toBe(104026)
|
||||
expect(getCacheCreationTokens(usage)).toBe(1530)
|
||||
})
|
||||
|
||||
it('keeps effective input token normalization unchanged', () => {
|
||||
expect(getEffectiveInputTokens({
|
||||
input_tokens: 100,
|
||||
|
||||
Reference in New Issue
Block a user