Browse Source

Add Diffusers model format and unknown handling

pull/298/head
Ionite 12 months ago
parent
commit
9e3e6a9c29
No known key found for this signature in database
  1. 1
      StabilityMatrix.Avalonia/App.axaml.cs
  2. 6
      StabilityMatrix.Core/Models/Api/CivitModelFormat.cs

1
StabilityMatrix.Avalonia/App.axaml.cs

@ -424,6 +424,7 @@ public sealed class App : Application
jsonSerializerOptions.Converters.Add(new ObjectToInferredTypesConverter()); jsonSerializerOptions.Converters.Add(new ObjectToInferredTypesConverter());
jsonSerializerOptions.Converters.Add(new DefaultUnknownEnumConverter<CivitFileType>()); jsonSerializerOptions.Converters.Add(new DefaultUnknownEnumConverter<CivitFileType>());
jsonSerializerOptions.Converters.Add(new DefaultUnknownEnumConverter<CivitModelType>()); jsonSerializerOptions.Converters.Add(new DefaultUnknownEnumConverter<CivitModelType>());
jsonSerializerOptions.Converters.Add(new DefaultUnknownEnumConverter<CivitModelFormat>());
jsonSerializerOptions.Converters.Add( jsonSerializerOptions.Converters.Add(
new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) new JsonStringEnumConverter(JsonNamingPolicy.CamelCase)
); );

6
StabilityMatrix.Core/Models/Api/CivitModelFormat.cs

@ -1,12 +1,14 @@
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using StabilityMatrix.Core.Converters.Json;
namespace StabilityMatrix.Core.Models.Api; namespace StabilityMatrix.Core.Models.Api;
[JsonConverter(typeof(DefaultUnknownEnumConverter<CivitModelFormat>))]
[JsonConverter(typeof(JsonStringEnumConverter))]
public enum CivitModelFormat public enum CivitModelFormat
{ {
Unknown,
SafeTensor, SafeTensor,
PickleTensor, PickleTensor,
Diffusers,
Other Other
} }

Loading…
Cancel
Save