agent: Refine language model selector (#28597)
Release Notes: - agent: Show recommended models in the agent model selector and display the provider in the model selector's trigger. --------- Co-authored-by: Danilo Leal <daniloleal09@gmail.com> Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
This commit is contained in:
parent
dafe994eef
commit
b22faf96e0
13 changed files with 350 additions and 218 deletions
|
@ -174,10 +174,6 @@ impl Default for LanguageModelTextStream {
|
|||
pub trait LanguageModel: Send + Sync {
|
||||
fn id(&self) -> LanguageModelId;
|
||||
fn name(&self) -> LanguageModelName;
|
||||
/// If None, falls back to [LanguageModelProvider::icon]
|
||||
fn icon(&self) -> Option<IconName> {
|
||||
None
|
||||
}
|
||||
fn provider_id(&self) -> LanguageModelProviderId;
|
||||
fn provider_name(&self) -> LanguageModelProviderName;
|
||||
fn telemetry_id(&self) -> String;
|
||||
|
@ -304,6 +300,9 @@ pub trait LanguageModelProvider: 'static {
|
|||
}
|
||||
fn default_model(&self, cx: &App) -> Option<Arc<dyn LanguageModel>>;
|
||||
fn provided_models(&self, cx: &App) -> Vec<Arc<dyn LanguageModel>>;
|
||||
fn recommended_models(&self, _cx: &App) -> Vec<Arc<dyn LanguageModel>> {
|
||||
Vec::new()
|
||||
}
|
||||
fn load_model(&self, _model: Arc<dyn LanguageModel>, _cx: &App) {}
|
||||
fn is_authenticated(&self, cx: &App) -> bool;
|
||||
fn authenticate(&self, cx: &mut App) -> Task<Result<(), AuthenticateError>>;
|
||||
|
|
|
@ -6,7 +6,6 @@ use client::Client;
|
|||
use gpui::{
|
||||
App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Global, ReadGlobal as _,
|
||||
};
|
||||
use icons::IconName;
|
||||
use proto::{Plan, TypedEnvelope};
|
||||
use schemars::JsonSchema;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -53,13 +52,6 @@ impl CloudModel {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn icon(&self) -> Option<IconName> {
|
||||
match self {
|
||||
Self::Anthropic(_) => Some(IconName::AiAnthropicHosted),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn max_token_count(&self) -> usize {
|
||||
match self {
|
||||
Self::Anthropic(model) => model.max_token_count(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue