- #70: implémentation suppression modèles locaux téléchargés - #100: correction scroll OpenCode - #102: correction fit TUI après switch/layout - memory note scoping UX
This commit is contained in:
@ -1311,6 +1311,22 @@ pub struct ModelArtifactResolution {
|
||||
pub cache_hit: bool,
|
||||
}
|
||||
|
||||
/// Cache state for a model artifact managed by IdeA.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum ModelArtifactState {
|
||||
/// Artifact source is not managed by the downloader.
|
||||
NotManaged,
|
||||
/// Managed artifact is not present in cache.
|
||||
Missing,
|
||||
/// Managed artifact is present in cache.
|
||||
Downloaded {
|
||||
/// Local path used to launch the model.
|
||||
path: ModelPath,
|
||||
/// Total on-disk bytes when known.
|
||||
size_bytes: Option<u64>,
|
||||
},
|
||||
}
|
||||
|
||||
/// Cooperative cancellation token for model artifact resolution.
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct ModelArtifactCancel {
|
||||
@ -1339,6 +1355,15 @@ impl ModelArtifactCancel {
|
||||
/// Resolves or downloads a model artifact before starting a model server.
|
||||
#[async_trait]
|
||||
pub trait ModelArtifactDownloader: Send + Sync {
|
||||
/// Returns the current cache state for a Hugging Face model reference.
|
||||
///
|
||||
/// # Errors
|
||||
/// [`ModelServerError`] when the cache cannot be inspected.
|
||||
async fn hf_model_state(
|
||||
&self,
|
||||
repo: &HfModelRef,
|
||||
) -> Result<ModelArtifactState, ModelServerError>;
|
||||
|
||||
/// Resolves a Hugging Face model to a local artifact path.
|
||||
///
|
||||
/// # Errors
|
||||
@ -1349,6 +1374,14 @@ pub trait ModelArtifactDownloader: Send + Sync {
|
||||
progress: Arc<dyn Fn(ModelArtifactProgress) + Send + Sync>,
|
||||
cancel: ModelArtifactCancel,
|
||||
) -> Result<ModelArtifactResolution, ModelServerError>;
|
||||
|
||||
/// Deletes the cached artifact for a Hugging Face model reference.
|
||||
///
|
||||
/// Deleting a missing artifact is a successful no-op.
|
||||
///
|
||||
/// # Errors
|
||||
/// [`ModelServerError`] when deletion fails.
|
||||
async fn delete_hf_model(&self, repo: &HfModelRef) -> Result<(), ModelServerError>;
|
||||
}
|
||||
|
||||
/// Manages local long-lived child processes.
|
||||
|
||||
Reference in New Issue
Block a user