assistant panel: Ensure always active tab is shown (#15618)
Small bug that snuck in with #15490. When closing the configuration tab explicitly and then activating the assistant tab again, it wouldn't show the configuration page. Release Notes: - N/A Co-authored-by: Bennet <bennet@zed.dev>
This commit is contained in:
parent
ac1a15f5d7
commit
6c83c7906a
1 changed files with 13 additions and 2 deletions
|
@ -1209,6 +1209,17 @@ impl Panel for AssistantPanel {
|
||||||
|
|
||||||
fn set_active(&mut self, active: bool, cx: &mut ViewContext<Self>) {
|
fn set_active(&mut self, active: bool, cx: &mut ViewContext<Self>) {
|
||||||
if active {
|
if active {
|
||||||
|
if self.pane.read(cx).items_len() == 0 {
|
||||||
|
if LanguageModelRegistry::read_global(cx)
|
||||||
|
.active_provider()
|
||||||
|
.is_none()
|
||||||
|
{
|
||||||
|
self.show_configuration_for_provider(None, cx);
|
||||||
|
} else {
|
||||||
|
self.new_context(cx);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
self.ensure_authenticated(cx);
|
self.ensure_authenticated(cx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3207,14 +3218,14 @@ impl Render for ConfigurationView {
|
||||||
Headline::new("Get Started with the Assistant").size(HeadlineSize::Medium),
|
Headline::new("Get Started with the Assistant").size(HeadlineSize::Medium),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
Label::new("Choose a provider to get started with the assistant.")
|
Label::new("Configure a provider to get started with the assistant. Then create a new context.")
|
||||||
.color(Color::Muted),
|
.color(Color::Muted),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
v_flex()
|
v_flex()
|
||||||
.gap_2()
|
.gap_2()
|
||||||
.child(Headline::new("Choosing a Provider").size(HeadlineSize::Small))
|
.child(Headline::new("Configure providers").size(HeadlineSize::Small))
|
||||||
.child(tabs)
|
.child(tabs)
|
||||||
.children(self.render_active_tab_view(cx)),
|
.children(self.render_active_tab_view(cx)),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue