This PR adds support for thread history to the Assistant 2 panel. We also now generate summaries for the threads. <img width="986" alt="Screenshot 2024-12-05 at 12 56 53 PM" src="https://github.com/user-attachments/assets/46cb1309-38a2-4ab9-9fcc-c1275d4b5f2c"> <img width="986" alt="Screenshot 2024-12-05 at 12 56 58 PM" src="https://github.com/user-attachments/assets/8c91ba57-a6c5-4b88-be05-b22fb615ece5"> Release Notes: - N/A --------- Co-authored-by: Piotr <piotr@zed.dev>
56 lines
1.4 KiB
Rust
56 lines
1.4 KiB
Rust
mod active_thread;
|
|
mod assistant_panel;
|
|
mod context_picker;
|
|
mod message_editor;
|
|
mod thread;
|
|
mod thread_history;
|
|
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,
|
|
OpenHistory,
|
|
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();
|
|
}
|