mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-22 22:44:13 +08:00
fix: include cache tokens in token usage display (#367)
* fix: Include cache tokens in the stats * Update format-turns.ts * fix test * format
This commit is contained in:
committed by
GitHub
parent
1b4ac7d7e0
commit
b4cc5cd6c5
@@ -372,8 +372,12 @@ export function formatGroupedContent(groupedContent: GroupedContent[]): string {
|
||||
const usage = item.usage || {};
|
||||
if (Object.keys(usage).length > 0) {
|
||||
const inputTokens = usage.input_tokens || 0;
|
||||
const cacheCreationTokens = usage.cache_creation_input_tokens || 0;
|
||||
const cacheReadTokens = usage.cache_read_input_tokens || 0;
|
||||
const totalInputTokens =
|
||||
inputTokens + cacheCreationTokens + cacheReadTokens;
|
||||
const outputTokens = usage.output_tokens || 0;
|
||||
markdown += `*Token usage: ${inputTokens} input, ${outputTokens} output*\n\n`;
|
||||
markdown += `*Token usage: ${totalInputTokens} input, ${outputTokens} output*\n\n`;
|
||||
}
|
||||
|
||||
// Only add separator if this section had content
|
||||
|
||||
Reference in New Issue
Block a user