Address local model download review

Return immediately from the server download endpoint and preserve terminal cancellation state for HF-backed downloads. Mark pre-download failures in the shared progress map so clients can surface actionable errors.
This commit is contained in:
jh-block
2026-05-12 12:08:47 +01:00
parent ad5c9aa93b
commit 0108a59ee0
3 changed files with 3 additions and 18 deletions
@@ -1742,7 +1742,7 @@ impl ProgressHandler for HfDownloadProgress {
update_download_manager_progress(&self.model_id, &state);
}
}
DownloadEvent::Complete => self.complete(),
DownloadEvent::Complete => {}
}
}
}
@@ -206,20 +206,15 @@ pub fn get_registry() -> &'static Mutex<LocalModelRegistry> {
})
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, ToSchema)]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub enum LocalModelStorage {
#[default]
GooseManaged,
HuggingFaceCache,
ManualPath,
}
impl Default for LocalModelStorage {
fn default() -> Self {
Self::GooseManaged
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ShardFile {
pub filename: String,
@@ -367,8 +367,6 @@ mod imp {
#[cfg(not(feature = "mlx"))]
mod imp {
use std::any::Any;
use crate::providers::errors::ProviderError;
use crate::providers::local_inference::backend::{
BackendLoadedModel, LocalGenerationRequest, LocalInferenceBackend,
@@ -386,14 +384,6 @@ mod imp {
}
}
struct UnavailableLoadedModel;
impl BackendLoadedModel for UnavailableLoadedModel {
fn as_any_mut(&mut self) -> &mut dyn Any {
self
}
}
impl LocalInferenceBackend for MlxBackend {
fn id(&self) -> &'static str {
MLX_BACKEND_ID