Add portrait settings support to school creation and update related API and UI components. Enhance error handling for invalid presets and ensure proper cloning of settings. Update tests to validate new functionality.
ci / server (push) Failing after 3m40s
ci / client (push) Failing after 14s

This commit is contained in:
Leonid Pershin
2026-08-20 08:17:58 +03:00
parent db95de0ddf
commit 9d96108516
20 changed files with 293 additions and 40 deletions
@@ -233,6 +233,33 @@ internal sealed class SwarmUiConfigFile
Presets = [SwarmUiPresetDefinition.CreateDefault(), SwarmUiPresetDefinition.CreateChild()],
AgeRules = [new SwarmUiAgeRule { MinAge = 6, MaxAge = 11, PresetId = "child" }],
};
public static SwarmUiConfigFile Clone(SwarmUiConfigFile source)
{
var json = JsonSerializer.Serialize(source, CloneJson);
var copy = JsonSerializer.Deserialize<SwarmUiConfigFile>(json, CloneJson) ?? CreateDefault();
copy.Model = null;
copy.Steps = null;
copy.CfgScale = null;
copy.ClipSkip = null;
copy.Sampler = null;
copy.Scheduler = null;
copy.Seed = null;
copy.Positive = null;
copy.Negative = null;
copy.Avatar = null;
copy.Custom = null;
copy.FullBody = null;
copy.NormalizeAfterLoad();
return copy;
}
private static readonly JsonSerializerOptions CloneJson = new()
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
PropertyNameCaseInsensitive = true,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
};
}
internal sealed class SwarmUiPresetDefinition