Multi-Platform Package Manager for Stable Diffusion
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.5 KiB

using System.Text.Json.Serialization;
using LiteDB;
namespace StabilityMatrix.Core.Models.Api;
public class CivitModel
{
[JsonPropertyName("id")]
public int Id { get; set; }
[JsonPropertyName("name")]
public string Name { get; set; }
[JsonPropertyName("description")]
public string Description { get; set; }
[JsonPropertyName("type")]
public CivitModelType Type { get; set; }
[JsonPropertyName("nsfw")]
public bool Nsfw { get; set; }
[JsonPropertyName("tags")]
public string[] Tags { get; set; }
[JsonPropertyName("mode")]
public CivitMode? Mode { get; set; }
[JsonPropertyName("creator")]
public CivitCreator Creator { get; set; }
[JsonPropertyName("stats")]
public CivitModelStats Stats { get; set; }
[BsonRef("ModelVersions")]
[JsonPropertyName("modelVersions")]
public List<CivitModelVersion>? ModelVersions { get; set; }
private FileSizeType? fullFilesSize;
public FileSizeType FullFilesSize
{
get
{
if (fullFilesSize != null) return fullFilesSize;
var kbs = 0.0;
var latestVersion = ModelVersions?.FirstOrDefault();
if (latestVersion?.Files != null && latestVersion.Files.Any())
{
var latestModelFile = latestVersion.Files.First();
kbs = latestModelFile.SizeKb;
}
fullFilesSize = new FileSizeType(kbs);
return fullFilesSize;
}
}
}