fix: tokens usage is nil (#2322)

This commit is contained in:
yetone
2025-06-24 20:44:04 +08:00
committed by GitHub
parent d6940f79d3
commit 270c11da57
2 changed files with 5 additions and 1 deletions

View File

@@ -2782,7 +2782,11 @@ function Sidebar:create_input_container()
return history and history.todos or {}
end,
session_ctx = {},
---@param usage avante.LLMTokenUsage
update_tokens_usage = function(usage)
if not usage then return end
if usage.completion_tokens == nil then return end
if usage.prompt_tokens == nil then return end
self.chat_history.tokens_usage = usage
self:save_history()
end,