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
58 lines
1.5 KiB
1 year ago
|
using System.Text.Json.Serialization;
|
||
1 year ago
|
using LiteDB;
|
||
1 year ago
|
|
||
1 year ago
|
namespace StabilityMatrix.Core.Models.Api;
|
||
1 year ago
|
|
||
|
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; }
|
||
|
|
||
1 year ago
|
[BsonRef("ModelVersions")]
|
||
1 year ago
|
[JsonPropertyName("modelVersions")]
|
||
1 year ago
|
public List<CivitModelVersion>? ModelVersions { get; set; }
|
||
1 year ago
|
|
||
1 year ago
|
private FileSizeType? fullFilesSize;
|
||
1 year ago
|
public FileSizeType FullFilesSize
|
||
|
{
|
||
|
get
|
||
|
{
|
||
1 year ago
|
if (fullFilesSize != null) return fullFilesSize;
|
||
|
var kbs = 0.0;
|
||
|
|
||
|
var latestVersion = ModelVersions?.FirstOrDefault();
|
||
|
if (latestVersion?.Files != null && latestVersion.Files.Any())
|
||
1 year ago
|
{
|
||
1 year ago
|
var latestModelFile = latestVersion.Files.First();
|
||
|
kbs = latestModelFile.SizeKb;
|
||
1 year ago
|
}
|
||
1 year ago
|
fullFilesSize = new FileSizeType(kbs);
|
||
|
return fullFilesSize;
|
||
1 year ago
|
}
|
||
|
}
|
||
1 year ago
|
}
|