feat(agent): model sync improvements - deduplication and offline status
- Add Offline status to ModelStatus enum - Sync marks all models offline first, then activates found ones - Deduplicate by model name (ignoring provider) - Deactivate orphaned models (offline -> deprecated) - Add models_offline and models_deactivated to SyncModelsResponse - Add deduplicate_existing_models() for cleanup - Rename upsert_model to upsert_model_by_name
This commit is contained in:
parent
52a0131b56
commit
e022240757
@ -67,12 +67,15 @@ impl std::str::FromStr for ModelCapability {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Model or model-version availability status. Stored as `"active"` or
|
/// Model or model-version availability status.
|
||||||
/// `"deprecated"`.
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
pub enum ModelStatus {
|
pub enum ModelStatus {
|
||||||
|
/// Model is available and can be used.
|
||||||
Active,
|
Active,
|
||||||
|
/// Model is no longer available from the provider.
|
||||||
Deprecated,
|
Deprecated,
|
||||||
|
/// Model was not found in the last upstream sync (offline).
|
||||||
|
Offline,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::fmt::Display for ModelStatus {
|
impl std::fmt::Display for ModelStatus {
|
||||||
@ -80,6 +83,7 @@ impl std::fmt::Display for ModelStatus {
|
|||||||
match self {
|
match self {
|
||||||
ModelStatus::Active => write!(f, "active"),
|
ModelStatus::Active => write!(f, "active"),
|
||||||
ModelStatus::Deprecated => write!(f, "deprecated"),
|
ModelStatus::Deprecated => write!(f, "deprecated"),
|
||||||
|
ModelStatus::Offline => write!(f, "offline"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,6 +94,7 @@ impl std::str::FromStr for ModelStatus {
|
|||||||
match s {
|
match s {
|
||||||
"active" => Ok(ModelStatus::Active),
|
"active" => Ok(ModelStatus::Active),
|
||||||
"deprecated" => Ok(ModelStatus::Deprecated),
|
"deprecated" => Ok(ModelStatus::Deprecated),
|
||||||
|
"offline" => Ok(ModelStatus::Offline),
|
||||||
_ => Err("unknown model status"),
|
_ => Err("unknown model status"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user