Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

assistant2: Prevent sending messages when the button is disabled (#26722)

Marshall Bowers22f1429f9713
diff --git a/crates/assistant2/src/message_editor.rs b/crates/assistant2/src/message_editor.rs
index 253152b3048..6708b7f40da 100644
--- a/crates/assistant2/src/message_editor.rs
+++ b/crates/assistant2/src/message_editor.rs
@@ -150,6 +150,14 @@ impl MessageEditor {
}
fn chat(&mut self, _: &Chat, window: &mut Window, cx: &mut Context<Self>) {
+ if self.is_editor_empty(cx) {
+ return;
+ }
+
+ if self.thread.read(cx).is_streaming() {
+ return;
+ }
+
self.send_to_model(RequestKind::Chat, window, cx);
}