mirror of
https://github.com/openai/codex.git
synced 2026-11-03 16:23:51 +00:00
chore: consolidate compaction token usage (#6894)
This commit is contained in:
1 parent
44c747837a
commit
3e9e1d993d
3 files changed
+10
-23
No files matched your search
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user