assistant2: Cancel generation button (#23137)

Turns the "esc to cancel" label into a button so it can be dispatched
via click or keyboard. The keybinding isn't hardcoded anymore.

![CleanShot 2025-01-14 at 13 44
22@2x](https://github.com/user-attachments/assets/a947f58b-7de2-400b-b95a-384b78c79697)


Release Notes:

- N/A
This commit is contained in:
Agus Zubiaga 2025-01-14 16:22:48 -03:00 committed by GitHub
parent 4febc7ea49
commit de5f023477
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 41 additions and 15 deletions

View file

@ -100,6 +100,16 @@ impl AssistantPanel {
let workspace = workspace.weak_handle();
let weak_self = cx.view().downgrade();
let message_editor = cx.new_view(|cx| {
MessageEditor::new(
fs.clone(),
workspace.clone(),
thread_store.downgrade(),
thread.clone(),
cx,
)
});
Self {
active_view: ActiveView::Thread,
workspace: workspace.clone(),
@ -109,21 +119,14 @@ impl AssistantPanel {
thread: cx.new_view(|cx| {
ActiveThread::new(
thread.clone(),
workspace.clone(),
workspace,
language_registry,
tools.clone(),
message_editor.focus_handle(cx),
cx,
)
}),
message_editor: cx.new_view(|cx| {
MessageEditor::new(
fs.clone(),
workspace,
thread_store.downgrade(),
thread.clone(),
cx,
)
}),
message_editor,
tools,
local_timezone: UtcOffset::from_whole_seconds(
chrono::Local::now().offset().local_minus_utc(),
@ -160,6 +163,7 @@ impl AssistantPanel {
self.workspace.clone(),
self.language_registry.clone(),
self.tools.clone(),
self.focus_handle(cx),
cx,
)
});
@ -196,6 +200,7 @@ impl AssistantPanel {
self.workspace.clone(),
self.language_registry.clone(),
self.tools.clone(),
self.focus_handle(cx),
cx,
)
});