This PR sketches in the chat editor for `assistant2`. <img width="1136" alt="Screenshot 2024-11-23 at 1 56 23 PM" src="https://github.com/user-attachments/assets/6e979995-c0cf-4a46-8694-fc4a8646336f"> Release Notes: - N/A
42 lines
1.2 KiB
Rust
42 lines
1.2 KiB
Rust
mod assistant_panel;
|
|
mod chat_editor;
|
|
|
|
use command_palette_hooks::CommandPaletteFilter;
|
|
use feature_flags::{Assistant2FeatureFlag, FeatureFlagAppExt};
|
|
use gpui::{actions, AppContext};
|
|
|
|
pub use crate::assistant_panel::AssistantPanel;
|
|
|
|
actions!(assistant2, [ToggleFocus, NewChat, ToggleModelSelector]);
|
|
|
|
const NAMESPACE: &str = "assistant2";
|
|
|
|
/// Initializes the `assistant2` crate.
|
|
pub fn init(cx: &mut AppContext) {
|
|
assistant_panel::init(cx);
|
|
feature_gate_assistant2_actions(cx);
|
|
}
|
|
|
|
fn feature_gate_assistant2_actions(cx: &mut AppContext) {
|
|
const ASSISTANT1_NAMESPACE: &str = "assistant";
|
|
|
|
CommandPaletteFilter::update_global(cx, |filter, _cx| {
|
|
filter.hide_namespace(NAMESPACE);
|
|
});
|
|
|
|
cx.observe_flag::<Assistant2FeatureFlag, _>(move |is_enabled, cx| {
|
|
if is_enabled {
|
|
CommandPaletteFilter::update_global(cx, |filter, _cx| {
|
|
filter.show_namespace(NAMESPACE);
|
|
filter.hide_namespace(ASSISTANT1_NAMESPACE);
|
|
});
|
|
} else {
|
|
CommandPaletteFilter::update_global(cx, |filter, _cx| {
|
|
filter.hide_namespace(NAMESPACE);
|
|
filter.show_namespace(ASSISTANT1_NAMESPACE);
|
|
});
|
|
}
|
|
})
|
|
.detach();
|
|
}
|