@@ -574,6 +574,7 @@
"ctrl-shift-h": "assistant2::OpenHistory",
"ctrl-alt-/": "assistant2::ToggleModelSelector",
"ctrl-shift-a": "assistant2::ToggleContextPicker",
+ "ctrl-e": "assistant2::ChatMode",
"ctrl-alt-e": "assistant2::RemoveAllContext"
}
},
@@ -229,6 +229,7 @@
"cmd-shift-h": "assistant2::OpenHistory",
"cmd-alt-/": "assistant2::ToggleModelSelector",
"cmd-shift-a": "assistant2::ToggleContextPicker",
+ "cmd-e": "assistant2::ChatMode",
"cmd-alt-e": "assistant2::RemoveAllContext"
}
},
@@ -43,6 +43,7 @@ actions!(
RemoveAllContext,
OpenHistory,
Chat,
+ ChatMode,
CycleNextInlineAssist,
CyclePreviousInlineAssist,
FocusUp,
@@ -23,7 +23,7 @@ use crate::context_store::{refresh_context_store_text, ContextStore};
use crate::context_strip::{ContextStrip, ContextStripEvent, SuggestContextKind};
use crate::thread::{RequestKind, Thread};
use crate::thread_store::ThreadStore;
-use crate::{Chat, RemoveAllContext, ToggleContextPicker, ToggleModelSelector};
+use crate::{Chat, ChatMode, RemoveAllContext, ToggleContextPicker, ToggleModelSelector};
pub struct MessageEditor {
thread: Model<Thread>,
@@ -116,6 +116,11 @@ impl MessageEditor {
self.model_selector_menu_handle.toggle(cx)
}
+ fn toggle_chat_mode(&mut self, _: &ChatMode, cx: &mut ViewContext<Self>) {
+ self.use_tools = !self.use_tools;
+ cx.notify();
+ }
+
fn toggle_context_picker(&mut self, _: &ToggleContextPicker, cx: &mut ViewContext<Self>) {
self.context_picker_menu_handle.toggle(cx);
}
@@ -264,6 +269,7 @@ impl Render for MessageEditor {
.on_action(cx.listener(Self::toggle_context_picker))
.on_action(cx.listener(Self::remove_all_context))
.on_action(cx.listener(Self::move_up))
+ .on_action(cx.listener(Self::toggle_chat_mode))
.size_full()
.gap_2()
.p_2()
@@ -323,7 +329,12 @@ impl Render for MessageEditor {
ToggleState::Unselected
| ToggleState::Indeterminate => false,
};
- })),
+ }))
+ .key_binding(KeyBinding::for_action_in(
+ &ChatMode,
+ &focus_handle,
+ cx,
+ )),
)
.child(
h_flex().gap_1().child(self.model_selector.clone()).child(