mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
fix(usage): Claude 流式合并 message_start/delta usage,前端移动端缓存 token 合并展示
- Claude provider state 在 message_start 记录基础 usage,message_delta 合并 output_tokens - 前端 UsageRecordsTable 移动端缓存列改为 cache_creation + cache_read 合计展示
This commit is contained in:
@@ -569,7 +569,7 @@
|
||||
<span>{{ formatTokens(record.output_tokens || 0) }}</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-1 text-muted-foreground">
|
||||
<span :class="hasPositiveTokens(record.cache_read_input_tokens) ? 'text-foreground/70' : ''">{{ formatOptionalTokens(record.cache_read_input_tokens) }}</span>
|
||||
<span :class="hasPositiveTokens(getRecordCacheTokens(record)) ? 'text-foreground/70' : ''">{{ formatOptionalTokens(getRecordCacheTokens(record)) }}</span>
|
||||
<span>/</span>
|
||||
<span>-</span>
|
||||
</div>
|
||||
@@ -689,7 +689,7 @@ import {
|
||||
import { RefreshCcw, Search } from 'lucide-vue-next'
|
||||
import { formatTokens, formatCurrency } from '@/utils/format'
|
||||
import { formatDateTime } from '../composables'
|
||||
import { getEffectiveInputTokens } from '../token-normalization'
|
||||
import { getCacheCreationTokens, getEffectiveInputTokens } from '../token-normalization'
|
||||
import {
|
||||
formatUsageStreamLabel,
|
||||
isUsageRecordFailed,
|
||||
@@ -825,6 +825,10 @@ function getRecordEffectiveInputTokens(record: UsageRecord): number {
|
||||
return getEffectiveInputTokens(record)
|
||||
}
|
||||
|
||||
function getRecordCacheTokens(record: UsageRecord): number {
|
||||
return getCacheCreationTokens(record) + (record.cache_read_input_tokens || 0)
|
||||
}
|
||||
|
||||
function hasPositiveTokens(value: number | null | undefined): boolean {
|
||||
return typeof value === 'number' && Number.isFinite(value) && value > 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user