Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
agent: Suggest turning burn mode on when close to the context window limit (#32691)
Danilo Leald280c95d9179
diff --git a/crates/agent/src/message_editor.rs b/crates/agent/src/message_editor.rsindex 824f58d8883..cd5fd591d03 100644--- a/crates/agent/src/message_editor.rs+++ b/crates/agent/src/message_editor.rs@@ -502,7 +502,7 @@ impl MessageEditor {cx.notify();}- fn render_max_mode_toggle(&self, cx: &mut Context<Self>) -> Option<AnyElement> {+ fn render_burn_mode_toggle(&self, cx: &mut Context<Self>) -> Option<AnyElement> {let thread = self.thread.read(cx);let model = thread.configured_model();if !model?.model.supports_max_mode() {@@ -717,7 +717,7 @@ impl MessageEditor {.child(h_flex().child(self.render_follow_toggle(cx))- .children(self.render_max_mode_toggle(cx)),+ .children(self.render_burn_mode_toggle(cx)),).child(h_flex()@@ -1256,7 +1256,7 @@ impl MessageEditor {.icon(icon).title(title).description(- "Start a new thread from a summary to continue the conversation.",+ "To continue, start a new thread from a summary or turn burn mode on.",).primary_action(Button::new("start-new-thread", "Start New Thread")@@ -1268,6 +1268,13 @@ impl MessageEditor {cx,);})),+ )+ .secondary_action(+ IconButton::new("burn-mode-callout", IconName::ZedBurnMode)+ .icon_size(IconSize::XSmall)+ .on_click(cx.listener(|this, _event, window, cx| {+ this.toggle_burn_mode(&ToggleBurnMode, window, cx);+ })),),),)@@ -1466,6 +1473,8 @@ impl Render for MessageEditor {total_token_usage.ratio()});+ let burn_mode_enabled = thread.completion_mode() == CompletionMode::Burn;+let action_log = self.thread.read(cx).action_log();let changed_buffers = action_log.read(cx).changed_buffers(cx);@@ -1482,7 +1491,7 @@ impl Render for MessageEditor {if usage_callout.is_some() {usage_callout- } else if token_usage_ratio != TokenUsageRatio::Normal {+ } else if token_usage_ratio != TokenUsageRatio::Normal && !burn_mode_enabled {self.render_token_limit_callout(line_height, token_usage_ratio, cx)} else {Nonediff --git a/crates/ui/src/components/callout.rs b/crates/ui/src/components/callout.rsindex 3b9b2f6c2a3..b3f3758db6c 100644--- a/crates/ui/src/components/callout.rs+++ b/crates/ui/src/components/callout.rs@@ -110,7 +110,7 @@ impl RenderOnce for Callout {|this| {this.child(h_flex()- .gap_1()+ .gap_0p5().when_some(self.secondary_action, |this, action| {this.child(action)})