assistant panel: Fix entering credentials not updating view (#15527)
Co-authored-by: Bennet <bennet@zed.dev> Release Notes: - N/A Co-authored-by: Bennet <bennet@zed.dev>
This commit is contained in:
parent
c78ea0df7e
commit
b571bc800d
10 changed files with 92 additions and 52 deletions
|
@ -86,10 +86,25 @@ pub trait LanguageModelProvider: 'static {
|
|||
fn authenticate(&self, cx: &mut AppContext) -> Task<Result<()>>;
|
||||
fn authentication_prompt(&self, cx: &mut WindowContext) -> AnyView;
|
||||
fn reset_credentials(&self, cx: &mut AppContext) -> Task<Result<()>>;
|
||||
|
||||
// fn observable_entity(&self) ;
|
||||
}
|
||||
|
||||
pub trait LanguageModelProviderState: 'static {
|
||||
fn subscribe<T: 'static>(&self, cx: &mut gpui::ModelContext<T>) -> Option<gpui::Subscription>;
|
||||
type ObservableEntity;
|
||||
|
||||
fn observable_entity(&self) -> Option<gpui::Model<Self::ObservableEntity>>;
|
||||
|
||||
fn subscribe<T: 'static>(
|
||||
&self,
|
||||
cx: &mut gpui::ModelContext<T>,
|
||||
callback: impl Fn(&mut T, &mut gpui::ModelContext<T>) + 'static,
|
||||
) -> Option<gpui::Subscription> {
|
||||
let entity = self.observable_entity()?;
|
||||
Some(cx.observe(&entity, move |this, _, cx| {
|
||||
callback(this, cx);
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Eq, PartialEq, Hash, Debug, Ord, PartialOrd)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue