mirror of
https://github.com/openai/codex.git
synced 2026-09-17 12:23:33 +00:00
bug
This commit is contained in:
@@ -146,7 +146,7 @@ impl ConversationHistory {
|
||||
}
|
||||
}
|
||||
|
||||
let prior_total = info.total_token_usage.total_tokens;
|
||||
let prior_total = info.last_token_usage.total_tokens;
|
||||
let combined_tokens = prior_total.saturating_add(input_tokens);
|
||||
let threshold = context_window * 95 / 100;
|
||||
if combined_tokens > threshold {
|
||||
|
||||
@@ -577,7 +577,9 @@ pub struct TokenUsage {
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
|
||||
pub struct TokenUsageInfo {
|
||||
/// The total token usage for the session. accumulated from all turns.
|
||||
pub total_token_usage: TokenUsage,
|
||||
/// The token usage for the last turn. Received from the API.
|
||||
pub last_token_usage: TokenUsage,
|
||||
#[ts(type = "number | null")]
|
||||
pub model_context_window: Option<i64>,
|
||||
|
||||
Reference in New Issue
Block a user