From 966bbba8198326c77c35bcc19bf26d9a4f26a90e Mon Sep 17 00:00:00 2001 From: jh-block Date: Fri, 20 Feb 2026 14:11:56 +0100 Subject: [PATCH] Remove display_name from local model API and use model ID everywhere (#7382) --- crates/goose-cli/src/cli.rs | 15 ++++++--------- .../goose-server/src/routes/local_inference.rs | 11 +++-------- .../local_inference/local_model_registry.rs | 12 ------------ ui/desktop/openapi.json | 4 ---- ui/desktop/src/api/types.gen.ts | 1 - ui/desktop/src/components/LocalModelSetup.tsx | 10 +++++----- .../localInference/LocalInferenceSettings.tsx | 17 ++++------------- 7 files changed, 18 insertions(+), 52 deletions(-) diff --git a/crates/goose-cli/src/cli.rs b/crates/goose-cli/src/cli.rs index 26487713ae..080e8975e6 100644 --- a/crates/goose-cli/src/cli.rs +++ b/crates/goose-cli/src/cli.rs @@ -1443,7 +1443,7 @@ async fn handle_term_subcommand(command: TermCommand) -> Result<()> { async fn handle_local_models_command(command: LocalModelsCommand) -> Result<()> { use goose::providers::local_inference::hf_models; use goose::providers::local_inference::local_model_registry::{ - display_name_from_repo, get_registry, model_id_from_repo, LocalModelEntry, + get_registry, model_id_from_repo, LocalModelEntry, }; match command { @@ -1482,13 +1482,12 @@ async fn handle_local_models_command(command: LocalModelsCommand) -> Result<()> println!("Resolving {}...", spec); let (repo_id, file) = hf_models::resolve_model_spec(&spec).await?; let model_id = model_id_from_repo(&repo_id, &file.quantization); - let display_name = display_name_from_repo(&repo_id, &file.quantization); let local_path = goose::config::paths::Paths::in_data_dir("models").join(&file.filename); println!( "Downloading {} ({})...", - display_name, + model_id, if file.size_bytes > 0 { format!( "{:.1}GB", @@ -1502,7 +1501,6 @@ async fn handle_local_models_command(command: LocalModelsCommand) -> Result<()> // Register let entry = LocalModelEntry { id: model_id.clone(), - display_name: display_name.clone(), repo_id: repo_id.clone(), filename: file.filename.clone(), quantization: file.quantization.clone(), @@ -1545,7 +1543,7 @@ async fn handle_local_models_command(command: LocalModelsCommand) -> Result<()> std::io::stdout().flush().ok(); } goose::download_manager::DownloadStatus::Completed => { - println!("\nDownloaded: {} (id: {})", display_name, model_id); + println!("\nDownloaded: {}", model_id); break; } goose::download_manager::DownloadStatus::Failed => { @@ -1572,13 +1570,12 @@ async fn handle_local_models_command(command: LocalModelsCommand) -> Result<()> return Ok(()); } - println!("{:<40} {:<20} {:<10} Downloaded", "ID", "Name", "Quant"); - println!("{}", "-".repeat(80)); + println!("{:<50} {:<10} Downloaded", "ID", "Quant"); + println!("{}", "-".repeat(70)); for m in models { println!( - "{:<40} {:<20} {:<10} {}", + "{:<50} {:<10} {}", m.id, - m.display_name, m.quantization, if m.is_downloaded() { "✓" } else { "✗" } ); diff --git a/crates/goose-server/src/routes/local_inference.rs b/crates/goose-server/src/routes/local_inference.rs index 321b1b3984..d93518e369 100644 --- a/crates/goose-server/src/routes/local_inference.rs +++ b/crates/goose-server/src/routes/local_inference.rs @@ -13,9 +13,8 @@ use goose::providers::local_inference::{ available_inference_memory_bytes, hf_models::{resolve_model_spec, HfGgufFile}, local_model_registry::{ - display_name_from_repo, get_registry, is_featured_model, model_id_from_repo, - LocalModelEntry, ModelDownloadStatus as RegistryDownloadStatus, ModelSettings, - FEATURED_MODELS, + get_registry, is_featured_model, model_id_from_repo, LocalModelEntry, + ModelDownloadStatus as RegistryDownloadStatus, ModelSettings, FEATURED_MODELS, }, recommend_local_model, }; @@ -40,7 +39,6 @@ pub enum ModelDownloadStatus { #[derive(Debug, Clone, Serialize, Deserialize, ToSchema)] pub struct LocalModelResponse { pub id: String, - pub display_name: String, pub repo_id: String, pub filename: String, pub quantization: String, @@ -94,7 +92,6 @@ async fn ensure_featured_models_in_registry() -> Result<(), ErrorResponse> { entries_to_add.push(LocalModelEntry { id: model_id, - display_name: display_name_from_repo(&repo_id, &quantization), repo_id, filename: hf_file.filename, quantization, @@ -158,7 +155,6 @@ pub async fn list_local_models( models.push(LocalModelResponse { id: entry.id.clone(), - display_name: entry.display_name.clone(), repo_id: entry.repo_id.clone(), filename: entry.filename.clone(), quantization: entry.quantization.clone(), @@ -175,7 +171,7 @@ pub async fn list_local_models( match (b_downloaded, a_downloaded) { (true, false) => std::cmp::Ordering::Greater, (false, true) => std::cmp::Ordering::Less, - _ => a.display_name.cmp(&b.display_name), + _ => a.id.cmp(&b.id), } }); @@ -272,7 +268,6 @@ pub async fn download_hf_model( let entry = LocalModelEntry { id: model_id.clone(), - display_name: display_name_from_repo(&repo_id, &quantization), repo_id, filename: hf_file.filename, quantization, diff --git a/crates/goose/src/providers/local_inference/local_model_registry.rs b/crates/goose/src/providers/local_inference/local_model_registry.rs index 898a138912..3ef80c6ae1 100644 --- a/crates/goose/src/providers/local_inference/local_model_registry.rs +++ b/crates/goose/src/providers/local_inference/local_model_registry.rs @@ -123,7 +123,6 @@ pub fn get_registry() -> &'static Mutex { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct LocalModelEntry { pub id: String, - pub display_name: String, pub repo_id: String, pub filename: String, pub quantization: String, @@ -306,14 +305,3 @@ impl LocalModelRegistry { pub fn model_id_from_repo(repo_id: &str, quantization: &str) -> String { format!("{}:{}", repo_id, quantization) } - -/// Generate a display name from repo_id and quantization. -pub fn display_name_from_repo(repo_id: &str, quantization: &str) -> String { - let model_name = repo_id - .split('/') - .next_back() - .unwrap_or(repo_id) - .trim_end_matches("-GGUF") - .trim_end_matches("-gguf"); - format!("{} ({})", model_name, quantization) -} diff --git a/ui/desktop/openapi.json b/ui/desktop/openapi.json index 2fee277007..71d5b69936 100644 --- a/ui/desktop/openapi.json +++ b/ui/desktop/openapi.json @@ -5185,7 +5185,6 @@ "type": "object", "required": [ "id", - "display_name", "repo_id", "filename", "quantization", @@ -5195,9 +5194,6 @@ "settings" ], "properties": { - "display_name": { - "type": "string" - }, "filename": { "type": "string" }, diff --git a/ui/desktop/src/api/types.gen.ts b/ui/desktop/src/api/types.gen.ts index a4bc570102..936ad95354 100644 --- a/ui/desktop/src/api/types.gen.ts +++ b/ui/desktop/src/api/types.gen.ts @@ -549,7 +549,6 @@ export type LoadedProvider = { }; export type LocalModelResponse = { - display_name: string; filename: string; id: string; quantization: string; diff --git a/ui/desktop/src/components/LocalModelSetup.tsx b/ui/desktop/src/components/LocalModelSetup.tsx index 4fe469d3a8..e26b514563 100644 --- a/ui/desktop/src/components/LocalModelSetup.tsx +++ b/ui/desktop/src/components/LocalModelSetup.tsx @@ -239,7 +239,7 @@ export function LocalModelSetup({ onSuccess, onCancel }: LocalModelSetupProps) {
- {recommended.display_name} + {recommended.id} {recommended.status.state === 'Downloaded' && ( @@ -294,7 +294,7 @@ export function LocalModelSetup({ onSuccess, onCancel }: LocalModelSetupProps) { />
- {model.display_name} + {model.id} {formatSize(model.size_bytes)} {model.status.state === 'Downloaded' && ( @@ -318,9 +318,9 @@ export function LocalModelSetup({ onSuccess, onCancel }: LocalModelSetupProps) { className="w-full px-6 py-3 bg-background-muted text-text-default rounded-lg transition-colors font-medium disabled:opacity-40 disabled:cursor-not-allowed hover:bg-background-muted/80" > {selectedModel?.status.state === 'Downloaded' - ? `Use ${selectedModel.display_name}` + ? `Use ${selectedModel.id}` : selectedModel - ? `Download ${selectedModel.display_name} (${formatSize(selectedModel.size_bytes)})` + ? `Download ${selectedModel.id} (${formatSize(selectedModel.size_bytes)})` : 'Select a model'} @@ -338,7 +338,7 @@ export function LocalModelSetup({ onSuccess, onCancel }: LocalModelSetupProps) {

- Downloading {selectedModel.display_name} + Downloading {selectedModel.id}

{downloadProgress ? ( diff --git a/ui/desktop/src/components/settings/localInference/LocalInferenceSettings.tsx b/ui/desktop/src/components/settings/localInference/LocalInferenceSettings.tsx index dc97643585..cdb6fccfa9 100644 --- a/ui/desktop/src/components/settings/localInference/LocalInferenceSettings.tsx +++ b/ui/desktop/src/components/settings/localInference/LocalInferenceSettings.tsx @@ -37,14 +37,6 @@ export const LocalInferenceSettings = () => { const downloadSectionRef = useRef(null); const selectedModelId = currentProvider === 'local' ? currentModel : null; - const getDisplayName = useCallback( - (modelId: string): string => { - const model = models.find((m) => m.id === modelId); - return model?.display_name || modelId; - }, - [models] - ); - const loadModels = useCallback(async () => { try { const response = await listLocalModels(); @@ -195,7 +187,6 @@ export const LocalInferenceSettings = () => {
{Array.from(downloads.entries()).map(([modelId, progress]) => { if (progress.status === 'completed') return null; - const displayName = getDisplayName(modelId); return (
{ >
- {displayName} + {modelId} {progress.status === 'downloading' && (