Fix status bar: show per-section budget breakdown
Budget display shows: sys 12% id 5% jnl 8% conv 40% = 15K/24K Old conversation log entries silently skipped (journal has context). Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
9c0533966a
commit
31e813f57d
2 changed files with 13 additions and 1 deletions
|
|
@ -843,7 +843,18 @@ impl ScreenView for InteractScreen {
|
|||
.unwrap_or_default();
|
||||
}
|
||||
if let Ok(ctx) = self.agent.context.try_lock() {
|
||||
app.status.context_budget = format!("{} tokens", ctx.tokens());
|
||||
let budget = crate::agent::context::context_budget_tokens();
|
||||
let sys = ctx.system().iter().map(|n| n.tokens()).sum::<usize>();
|
||||
let id = ctx.identity().iter().map(|n| n.tokens()).sum::<usize>();
|
||||
let jnl = ctx.journal().iter().map(|n| n.tokens()).sum::<usize>();
|
||||
let conv = ctx.conversation().iter().map(|n| n.tokens()).sum::<usize>();
|
||||
let total = sys + id + jnl + conv;
|
||||
let pct = |n: usize| if budget > 0 { n * 100 / budget } else { 0 };
|
||||
app.status.context_budget = format!(
|
||||
"sys {}% id {}% jnl {}% conv {}% = {}K/{}K",
|
||||
pct(sys), pct(id), pct(jnl), pct(conv),
|
||||
total / 1000, budget / 1000,
|
||||
);
|
||||
}
|
||||
{
|
||||
let mind = self.shared_mind.lock().unwrap();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue