Avoid loading the assistant panel on stable
This commit is contained in:
parent
56b0bf8601
commit
049c987310
2 changed files with 21 additions and 12 deletions
|
@ -29,7 +29,7 @@ use std::{
|
||||||
borrow::Cow, cell::RefCell, cmp, fmt::Write, io, iter, ops::Range, rc::Rc, sync::Arc,
|
borrow::Cow, cell::RefCell, cmp, fmt::Write, io, iter, ops::Range, rc::Rc, sync::Arc,
|
||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
use util::{post_inc, truncate_and_trailoff, ResultExt, TryFutureExt};
|
use util::{channel::ReleaseChannel, post_inc, truncate_and_trailoff, ResultExt, TryFutureExt};
|
||||||
use workspace::{
|
use workspace::{
|
||||||
dock::{DockPosition, Panel},
|
dock::{DockPosition, Panel},
|
||||||
item::Item,
|
item::Item,
|
||||||
|
@ -44,6 +44,12 @@ actions!(
|
||||||
);
|
);
|
||||||
|
|
||||||
pub fn init(cx: &mut AppContext) {
|
pub fn init(cx: &mut AppContext) {
|
||||||
|
if *util::channel::RELEASE_CHANNEL == ReleaseChannel::Stable {
|
||||||
|
cx.update_default_global::<collections::CommandPaletteFilter, _, _>(move |filter, _cx| {
|
||||||
|
filter.filtered_namespaces.insert("assistant");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
settings::register::<AssistantSettings>(cx);
|
settings::register::<AssistantSettings>(cx);
|
||||||
cx.add_action(
|
cx.add_action(
|
||||||
|workspace: &mut Workspace, _: &NewContext, cx: &mut ViewContext<Workspace>| {
|
|workspace: &mut Workspace, _: &NewContext, cx: &mut ViewContext<Workspace>| {
|
||||||
|
@ -60,6 +66,11 @@ pub fn init(cx: &mut AppContext) {
|
||||||
cx.capture_action(AssistantEditor::copy);
|
cx.capture_action(AssistantEditor::copy);
|
||||||
cx.add_action(AssistantPanel::save_api_key);
|
cx.add_action(AssistantPanel::save_api_key);
|
||||||
cx.add_action(AssistantPanel::reset_api_key);
|
cx.add_action(AssistantPanel::reset_api_key);
|
||||||
|
cx.add_action(
|
||||||
|
|workspace: &mut Workspace, _: &ToggleFocus, cx: &mut ViewContext<Workspace>| {
|
||||||
|
workspace.toggle_panel_focus::<AssistantPanel>(cx);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum AssistantPanelEvent {
|
pub enum AssistantPanelEvent {
|
||||||
|
|
|
@ -254,13 +254,6 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut gpui::AppContext) {
|
||||||
workspace.toggle_panel_focus::<TerminalPanel>(cx);
|
workspace.toggle_panel_focus::<TerminalPanel>(cx);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
cx.add_action(
|
|
||||||
|workspace: &mut Workspace,
|
|
||||||
_: &ai::assistant::ToggleFocus,
|
|
||||||
cx: &mut ViewContext<Workspace>| {
|
|
||||||
workspace.toggle_panel_focus::<AssistantPanel>(cx);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
cx.add_global_action({
|
cx.add_global_action({
|
||||||
let app_state = Arc::downgrade(&app_state);
|
let app_state = Arc::downgrade(&app_state);
|
||||||
move |_: &NewWindow, cx: &mut AppContext| {
|
move |_: &NewWindow, cx: &mut AppContext| {
|
||||||
|
@ -368,9 +361,12 @@ pub fn initialize_workspace(
|
||||||
|
|
||||||
let project_panel = ProjectPanel::load(workspace_handle.clone(), cx.clone());
|
let project_panel = ProjectPanel::load(workspace_handle.clone(), cx.clone());
|
||||||
let terminal_panel = TerminalPanel::load(workspace_handle.clone(), cx.clone());
|
let terminal_panel = TerminalPanel::load(workspace_handle.clone(), cx.clone());
|
||||||
let assistant_panel = AssistantPanel::load(workspace_handle.clone(), cx.clone());
|
let assistant_panel = if *util::channel::RELEASE_CHANNEL == ReleaseChannel::Stable {
|
||||||
let (project_panel, terminal_panel, assistant_panel) =
|
None
|
||||||
futures::try_join!(project_panel, terminal_panel, assistant_panel)?;
|
} else {
|
||||||
|
Some(AssistantPanel::load(workspace_handle.clone(), cx.clone()).await?)
|
||||||
|
};
|
||||||
|
let (project_panel, terminal_panel) = futures::try_join!(project_panel, terminal_panel)?;
|
||||||
workspace_handle.update(&mut cx, |workspace, cx| {
|
workspace_handle.update(&mut cx, |workspace, cx| {
|
||||||
let project_panel_position = project_panel.position(cx);
|
let project_panel_position = project_panel.position(cx);
|
||||||
workspace.add_panel(project_panel, cx);
|
workspace.add_panel(project_panel, cx);
|
||||||
|
@ -389,7 +385,9 @@ pub fn initialize_workspace(
|
||||||
}
|
}
|
||||||
|
|
||||||
workspace.add_panel(terminal_panel, cx);
|
workspace.add_panel(terminal_panel, cx);
|
||||||
|
if let Some(assistant_panel) = assistant_panel {
|
||||||
workspace.add_panel(assistant_panel, cx);
|
workspace.add_panel(assistant_panel, cx);
|
||||||
|
}
|
||||||
})?;
|
})?;
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue