chore: consolidate compaction token usage (#6894)

This commit is contained in:
jif-oai
2025-11-19 11:26:01 +00:00
committed by GitHub
Unverified
parent 44c747837a
commit 3e9e1d993d
3 changed files with 10 additions and 23 deletions
+8 -5
View File
@@ -1085,11 +1085,14 @@ impl Session {
self.send_token_count_event(turn_context).await;
}
pub(crate) async fn override_last_token_usage_estimate(
&self,
turn_context: &TurnContext,
estimated_total_tokens: i64,
) {
pub(crate) async fn recompute_token_usage(&self, turn_context: &TurnContext) {
let Some(estimated_total_tokens) = self
.clone_history()
.await
.estimate_token_count(turn_context)
else {
return;
};
{
let mut state = self.state.lock().await;
let mut info = state.token_info().unwrap_or(TokenUsageInfo {