agent: Suggest turning burn mode on when close to the context window limit (#32691)
Previously, upon getting close to reaching the context window, we'd just suggest creating a new thread using the summary of the current one. Now, we also suggest turning burn mode on as an alternative action to solve the context window problem. Release Notes: - agent: Added a suggestion to turn burn mode on when getting close to the context window limit.
This commit is contained in:
parent
fcf5042007
commit
d280c95d91
2 changed files with 14 additions and 5 deletions
|
@ -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 {
|
||||
None
|
||||
|
|
|
@ -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)
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue