Simplify trim_entries, kill ContextBudget
trim_entries is now a simple loop: 1. Drop duplicate memories and DMN entries 2. While over budget: if memories > 50% of entry tokens, drop lowest-scored memory; otherwise drop oldest conversation entry 3. Snap to user message boundary ContextBudget is gone — sections already have cached token totals: - total_tokens() on ContextState replaces budget.total() - format_budget() on ContextState replaces budget.format() - trim() takes fixed_tokens: usize (system + identity + journal) Co-Authored-By: Proof of Concept <poc@bcachefs.org> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
62996e27d7
commit
b892cae2be
4 changed files with 68 additions and 133 deletions
|
|
@ -863,7 +863,7 @@ impl ScreenView for InteractScreen {
|
|||
agent.expire_activities();
|
||||
app.status.prompt_tokens = agent.last_prompt_tokens();
|
||||
app.status.model = agent.model().to_string();
|
||||
app.status.context_budget = agent.context_budget().format();
|
||||
app.status.context_budget = agent.context.format_budget();
|
||||
app.activity = agent.activities.last()
|
||||
.map(|a| a.label.clone())
|
||||
.unwrap_or_default();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue