mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-04-07 08:25:23 +02:00
fix: handle usage_metadata in title transaction for Gemini models
Gemini models return token usage via `usage_metadata` instead of `usage` or `tokenUsage`. The `collectedUsage` mapping in `titleConvo` only handled the latter two, causing title generation transactions to be silently skipped for Gemini. Adds an `else if (item.usage_metadata)` branch to extract `input_tokens`/`output_tokens`. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
5a373825a5
commit
1a9dbb76a4
1 changed files with 3 additions and 0 deletions
|
|
@ -1125,6 +1125,9 @@ class AgentClient extends BaseClient {
|
|||
} else if (item.tokenUsage) {
|
||||
input_tokens = item.tokenUsage.promptTokens;
|
||||
output_tokens = item.tokenUsage.completionTokens;
|
||||
} else if (item.usage_metadata) {
|
||||
input_tokens = item.usage_metadata.input_tokens;
|
||||
output_tokens = item.usage_metadata.output_tokens;
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue