From 22f1429f9713dbbf75edc724fa987c9f4f5bb8c7 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Thu, 13 Mar 2025 16:49:21 -0400 Subject: [PATCH] assistant2: Prevent sending messages when the button is disabled (#26722) This PR updates the `Chat` action handler to prevent sending messages in the states when the submit button is disabled. Release Notes: - N/A --- crates/assistant2/src/message_editor.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/assistant2/src/message_editor.rs b/crates/assistant2/src/message_editor.rs index 253152b3048e7193d30604778ed94f443c9e3e0a..6708b7f40dae089e1f8fc52a09bd1f975d21213c 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) { + if self.is_editor_empty(cx) { + return; + } + + if self.thread.read(cx).is_streaming() { + return; + } + self.send_to_model(RequestKind::Chat, window, cx); }