- #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:
@ -1343,7 +1343,10 @@ impl From<FirstRunStateOutput> for FirstRunStateDto {
|
||||
// Local model servers (B35)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
use application::{ListModelServersOutput, SaveModelServerInput, SaveModelServerOutput};
|
||||
use application::{
|
||||
ListModelServersOutput, ModelArtifactView, ModelServerListItem, SaveModelServerInput,
|
||||
SaveModelServerOutput,
|
||||
};
|
||||
use domain::model_server::{
|
||||
ExecutablePath, HfModelRef, LlamaCppOptions, LocalModelRef, LocalModelServerConfig,
|
||||
LocalModelServerKind, ModelPath, ModelServerEndpoint, ModelSource,
|
||||
@ -1492,6 +1495,9 @@ pub struct ModelServerConfigDto {
|
||||
/// Optional readiness warmup deadline override in seconds.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub warmup_deadline_secs: Option<u64>,
|
||||
/// Derived local artifact cache state.
|
||||
#[serde(default)]
|
||||
pub artifact: ModelArtifactDto,
|
||||
}
|
||||
|
||||
impl ModelServerConfigDto {
|
||||
@ -1516,6 +1522,7 @@ impl ModelServerConfigDto {
|
||||
auto_start: config.auto_start,
|
||||
stop_policy: config.stop_policy.into(),
|
||||
warmup_deadline_secs: config.warmup_deadline_secs,
|
||||
artifact: ModelArtifactDto::NotManaged,
|
||||
}
|
||||
}
|
||||
|
||||
@ -1563,6 +1570,53 @@ impl ModelServerConfigDto {
|
||||
}
|
||||
}
|
||||
|
||||
/// Local model artifact cache state on the IPC wire.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase", tag = "state")]
|
||||
pub enum ModelArtifactDto {
|
||||
/// The configured source is not managed by IdeA's downloader.
|
||||
NotManaged,
|
||||
/// The configured source is managed but not present in cache.
|
||||
Missing,
|
||||
/// A download/prepare operation is currently running for this server.
|
||||
Downloading,
|
||||
/// The configured source is present in cache.
|
||||
Downloaded {
|
||||
/// Local artifact path.
|
||||
path: String,
|
||||
/// Total on-disk size when known.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
size_bytes: Option<u64>,
|
||||
},
|
||||
}
|
||||
|
||||
impl Default for ModelArtifactDto {
|
||||
fn default() -> Self {
|
||||
Self::NotManaged
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ModelArtifactView> for ModelArtifactDto {
|
||||
fn from(view: ModelArtifactView) -> Self {
|
||||
match view {
|
||||
ModelArtifactView::NotManaged => Self::NotManaged,
|
||||
ModelArtifactView::Missing => Self::Missing,
|
||||
ModelArtifactView::Downloading => Self::Downloading,
|
||||
ModelArtifactView::Downloaded { path, size_bytes } => {
|
||||
Self::Downloaded { path, size_bytes }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ModelServerListItem> for ModelServerConfigDto {
|
||||
fn from(item: ModelServerListItem) -> Self {
|
||||
let mut dto = Self::from_domain(item.config);
|
||||
dto.artifact = item.artifact.into();
|
||||
dto
|
||||
}
|
||||
}
|
||||
|
||||
/// Response DTO for `preview_model_server_command`.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
@ -1585,7 +1639,7 @@ impl From<ListModelServersOutput> for ModelServerConfigListDto {
|
||||
Self(
|
||||
out.servers
|
||||
.into_iter()
|
||||
.map(ModelServerConfigDto::from_domain)
|
||||
.map(ModelServerConfigDto::from)
|
||||
.collect(),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user