namespace LlamaApp.Common; /// /// Progress report for a model download — fed to IProgress<DownloadProgress> /// by LlamaManager.DownloadModel as the llama server streams SSE updates. /// /// Repo id of the model being downloaded. /// Bytes fetched so far (summed across all files in a multi-file repo). /// Total bytes to fetch; 0 when the server hasn't reported a size yet. /// True, once the download has completed successfully. /// True if the download failed. /// Human-readable status / error message, when relevant. public sealed record ModelDownloadProgress( string Model, long DownloadedBytes, long TotalBytes, bool Done, bool Failed, string? Message = null) { /// Fraction completed (0..1), or 0 when the total isn't known yet. public double Fraction => TotalBytes > 0.0d ? (double)DownloadedBytes / TotalBytes : 0.0d; }