This PR adds support to Assistant 2 for using tools provided by context servers. As part of this I introduced a new `ThreadStore`. Release Notes: - N/A --------- Co-authored-by: Cole <cole@zed.dev>
47 lines
1.3 KiB
Rust
47 lines
1.3 KiB
Rust
mod assistant_panel;
|
|
mod message_editor;
|
|
mod thread;
|
|
mod thread_store;
|
|
|
|
use command_palette_hooks::CommandPaletteFilter;
|
|
use feature_flags::{Assistant2FeatureFlag, FeatureFlagAppExt};
|
|
use gpui::{actions, AppContext};
|
|
|
|
pub use crate::assistant_panel::AssistantPanel;
|
|
|
|
actions!(
|
|
assistant2,
|
|
[ToggleFocus, NewThread, ToggleModelSelector, Chat]
|
|
);
|
|
|
|
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();
|
|
}
|