Revert "assistant panel: Fix entering credentials not updating view" (#15528)

Reverts zed-industries/zed#15527

We broke the assistant panel in the process...

Release Notes:

- N/A
This commit is contained in:
Bennet Bo Fenner 2024-07-31 13:26:27 +02:00 committed by GitHub
parent b571bc800d
commit 380a19fcf2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 52 additions and 92 deletions

View file

@ -44,7 +44,7 @@ pub struct AnthropicLanguageModelProvider {
state: gpui::Model<State>,
}
pub struct State {
struct State {
api_key: Option<String>,
_subscription: Subscription,
}
@ -61,12 +61,11 @@ impl AnthropicLanguageModelProvider {
Self { http_client, state }
}
}
impl LanguageModelProviderState for AnthropicLanguageModelProvider {
type ObservableEntity = State;
fn observable_entity(&self) -> Option<gpui::Model<Self::ObservableEntity>> {
Some(self.state.clone())
fn subscribe<T: 'static>(&self, cx: &mut gpui::ModelContext<T>) -> Option<gpui::Subscription> {
Some(cx.observe(&self.state, |_, _, cx| {
cx.notify();
}))
}
}

View file

@ -50,7 +50,7 @@ pub struct CloudLanguageModelProvider {
_maintain_client_status: Task<()>,
}
pub struct State {
struct State {
client: Arc<Client>,
status: client::Status,
_subscription: Subscription,
@ -99,10 +99,10 @@ impl CloudLanguageModelProvider {
}
impl LanguageModelProviderState for CloudLanguageModelProvider {
type ObservableEntity = State;
fn observable_entity(&self) -> Option<gpui::Model<Self::ObservableEntity>> {
Some(self.state.clone())
fn subscribe<T: 'static>(&self, cx: &mut gpui::ModelContext<T>) -> Option<gpui::Subscription> {
Some(cx.observe(&self.state, |_, _, cx| {
cx.notify();
}))
}
}

View file

@ -11,8 +11,8 @@ use futures::future::BoxFuture;
use futures::stream::BoxStream;
use futures::{FutureExt, StreamExt};
use gpui::{
percentage, svg, Animation, AnimationExt, AnyView, AppContext, AsyncAppContext, Model, Render,
Subscription, Task, Transformation,
percentage, svg, Animation, AnimationExt, AnyView, AppContext, AsyncAppContext, Model,
ModelContext, Render, Subscription, Task, Transformation,
};
use settings::{Settings, SettingsStore};
use std::time::Duration;
@ -67,10 +67,10 @@ impl CopilotChatLanguageModelProvider {
}
impl LanguageModelProviderState for CopilotChatLanguageModelProvider {
type ObservableEntity = State;
fn observable_entity(&self) -> Option<gpui::Model<Self::ObservableEntity>> {
Some(self.state.clone())
fn subscribe<T: 'static>(&self, cx: &mut ModelContext<T>) -> Option<Subscription> {
Some(cx.observe(&self.state, |_, _, cx| {
cx.notify();
}))
}
}

View file

@ -36,9 +36,7 @@ pub struct FakeLanguageModelProvider {
}
impl LanguageModelProviderState for FakeLanguageModelProvider {
type ObservableEntity = ();
fn observable_entity(&self) -> Option<gpui::Model<Self::ObservableEntity>> {
fn subscribe<T: 'static>(&self, _: &mut gpui::ModelContext<T>) -> Option<gpui::Subscription> {
None
}
}

View file

@ -44,7 +44,7 @@ pub struct GoogleLanguageModelProvider {
state: gpui::Model<State>,
}
pub struct State {
struct State {
api_key: Option<String>,
_subscription: Subscription,
}
@ -63,10 +63,10 @@ impl GoogleLanguageModelProvider {
}
impl LanguageModelProviderState for GoogleLanguageModelProvider {
type ObservableEntity = State;
fn observable_entity(&self) -> Option<gpui::Model<Self::ObservableEntity>> {
Some(self.state.clone())
fn subscribe<T: 'static>(&self, cx: &mut gpui::ModelContext<T>) -> Option<gpui::Subscription> {
Some(cx.observe(&self.state, |_, _, cx| {
cx.notify();
}))
}
}

View file

@ -32,7 +32,7 @@ pub struct OllamaLanguageModelProvider {
state: gpui::Model<State>,
}
pub struct State {
struct State {
http_client: Arc<dyn HttpClient>,
available_models: Vec<ollama::Model>,
_subscription: Subscription,
@ -87,10 +87,10 @@ impl OllamaLanguageModelProvider {
}
impl LanguageModelProviderState for OllamaLanguageModelProvider {
type ObservableEntity = State;
fn observable_entity(&self) -> Option<gpui::Model<Self::ObservableEntity>> {
Some(self.state.clone())
fn subscribe<T: 'static>(&self, cx: &mut gpui::ModelContext<T>) -> Option<gpui::Subscription> {
Some(cx.observe(&self.state, |_, _, cx| {
cx.notify();
}))
}
}

View file

@ -45,7 +45,7 @@ pub struct OpenAiLanguageModelProvider {
state: gpui::Model<State>,
}
pub struct State {
struct State {
api_key: Option<String>,
_subscription: Subscription,
}
@ -64,10 +64,10 @@ impl OpenAiLanguageModelProvider {
}
impl LanguageModelProviderState for OpenAiLanguageModelProvider {
type ObservableEntity = State;
fn observable_entity(&self) -> Option<gpui::Model<Self::ObservableEntity>> {
Some(self.state.clone())
fn subscribe<T: 'static>(&self, cx: &mut gpui::ModelContext<T>) -> Option<gpui::Subscription> {
Some(cx.observe(&self.state, |_, _, cx| {
cx.notify();
}))
}
}