mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
chore: consolidate compaction token usage (#6894)
This commit is contained in:
committed by
GitHub
Unverified
parent
44c747837a
commit
3e9e1d993d
@@ -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