diff --git a/StabilityMatrix.Avalonia/Languages/Resources.Designer.cs b/StabilityMatrix.Avalonia/Languages/Resources.Designer.cs index c1a86510..84018926 100644 --- a/StabilityMatrix.Avalonia/Languages/Resources.Designer.cs +++ b/StabilityMatrix.Avalonia/Languages/Resources.Designer.cs @@ -599,6 +599,15 @@ namespace StabilityMatrix.Avalonia.Languages { } } + /// + /// Looks up a localized string similar to Addons. + /// + public static string Label_Addons { + get { + return ResourceManager.GetString("Label_Addons", resourceCulture); + } + } + /// /// Looks up a localized string similar to Add Stability Matrix to the Start Menu. /// @@ -1760,6 +1769,15 @@ namespace StabilityMatrix.Avalonia.Languages { } } + /// + /// Looks up a localized string similar to Save Intermediate Image. + /// + public static string Label_SaveIntermediateImage { + get { + return ResourceManager.GetString("Label_SaveIntermediateImage", resourceCulture); + } + } + /// /// Looks up a localized string similar to Search.... /// diff --git a/StabilityMatrix.Avalonia/Languages/Resources.resx b/StabilityMatrix.Avalonia/Languages/Resources.resx index d7b1cca5..e3864dbb 100644 --- a/StabilityMatrix.Avalonia/Languages/Resources.resx +++ b/StabilityMatrix.Avalonia/Languages/Resources.resx @@ -858,4 +858,10 @@ System Information + + AddonsInference Sampler Addons + + + Save Intermediate ImageInference module step to save an intermediate image + diff --git a/StabilityMatrix.Avalonia/ViewModels/Inference/Modules/SaveImageModule.cs b/StabilityMatrix.Avalonia/ViewModels/Inference/Modules/SaveImageModule.cs index 72e3bb22..cfe39389 100644 --- a/StabilityMatrix.Avalonia/ViewModels/Inference/Modules/SaveImageModule.cs +++ b/StabilityMatrix.Avalonia/ViewModels/Inference/Modules/SaveImageModule.cs @@ -1,4 +1,5 @@ -using StabilityMatrix.Avalonia.Models.Inference; +using StabilityMatrix.Avalonia.Languages; +using StabilityMatrix.Avalonia.Models.Inference; using StabilityMatrix.Avalonia.Services; using StabilityMatrix.Avalonia.ViewModels.Base; using StabilityMatrix.Core.Attributes; @@ -14,19 +15,21 @@ public class SaveImageModule : ModuleBase public SaveImageModule(ServiceManager vmFactory) : base(vmFactory) { - Title = "Save Intermediary Image"; + Title = Resources.Label_SaveIntermediateImage; } /// protected override void OnApplyStep(ModuleApplyStepEventArgs e) { - var preview = e.Builder.Nodes.AddTypedNode( - new ComfyNodeBuilder.PreviewImage - { - Name = e.Builder.Nodes.GetUniqueName("SaveIntermediaryImage"), - Images = e.Builder.GetPrimaryAsImage() - } - ); + var preview = e.Builder + .Nodes + .AddTypedNode( + new ComfyNodeBuilder.PreviewImage + { + Name = e.Builder.Nodes.GetUniqueName("SaveIntermediateImage"), + Images = e.Builder.GetPrimaryAsImage() + } + ); e.Builder.Connections.OutputNodes.Add(preview); } diff --git a/StabilityMatrix.Avalonia/ViewModels/Inference/SamplerCardViewModel.cs b/StabilityMatrix.Avalonia/ViewModels/Inference/SamplerCardViewModel.cs index eb975d24..230b2f28 100644 --- a/StabilityMatrix.Avalonia/ViewModels/Inference/SamplerCardViewModel.cs +++ b/StabilityMatrix.Avalonia/ViewModels/Inference/SamplerCardViewModel.cs @@ -1,10 +1,11 @@ using System; -using System.Collections.Immutable; using System.ComponentModel.DataAnnotations; using System.Linq; +using System.Runtime.Serialization; using System.Text.Json.Serialization; using CommunityToolkit.Mvvm.ComponentModel; using StabilityMatrix.Avalonia.Controls; +using StabilityMatrix.Avalonia.Languages; using StabilityMatrix.Avalonia.Models; using StabilityMatrix.Avalonia.Models.Inference; using StabilityMatrix.Avalonia.Services; @@ -21,10 +22,7 @@ namespace StabilityMatrix.Avalonia.ViewModels.Inference; [View(typeof(SamplerCard))] [ManagedService] [Transient] -public partial class SamplerCardViewModel - : LoadableViewModelBase, - IParametersLoadableState, - IComfyStep +public partial class SamplerCardViewModel : LoadableViewModelBase, IParametersLoadableState, IComfyStep { public const string ModuleKey = "Sampler"; @@ -80,15 +78,12 @@ public partial class SamplerCardViewModel private int TotalSteps => Steps + RefinerSteps; - public SamplerCardViewModel( - IInferenceClientManager clientManager, - ServiceManager vmFactory - ) + public SamplerCardViewModel(IInferenceClientManager clientManager, ServiceManager vmFactory) { ClientManager = clientManager; ModulesCardViewModel = vmFactory.Get(modulesCard => { - modulesCard.Title = "Addons"; + modulesCard.Title = Resources.Label_Addons; modulesCard.AvailableModules = new[] { typeof(FreeUModule), typeof(ControlNetModule) }; modulesCard.InitializeDefaults(); }); @@ -146,8 +141,7 @@ public partial class SamplerCardViewModel var primaryLatent = e.Builder.GetPrimaryAsLatent(vae); // Set primary sampler and scheduler - e.Builder.Connections.PrimarySampler = - SelectedSampler ?? throw new ValidationException("Sampler not selected"); + e.Builder.Connections.PrimarySampler = SelectedSampler ?? throw new ValidationException("Sampler not selected"); e.Builder.Connections.PrimaryScheduler = SelectedScheduler ?? throw new ValidationException("Scheduler not selected"); @@ -159,9 +153,7 @@ public partial class SamplerCardViewModel new ComfyNodeBuilder.KSampler { Name = "Sampler", - Model = - e.Builder.Connections.BaseModel - ?? throw new ArgumentException("No BaseModel"), + Model = e.Builder.Connections.BaseModel ?? throw new ArgumentException("No BaseModel"), Seed = e.Builder.Connections.Seed, SamplerName = e.Builder.Connections.PrimarySampler?.Name!, Scheduler = e.Builder.Connections.PrimaryScheduler?.Name!, @@ -183,9 +175,7 @@ public partial class SamplerCardViewModel new ComfyNodeBuilder.KSamplerAdvanced { Name = "Sampler", - Model = - e.Builder.Connections.BaseModel - ?? throw new ArgumentException("No BaseModel"), + Model = e.Builder.Connections.BaseModel ?? throw new ArgumentException("No BaseModel"), AddNoise = true, NoiseSeed = e.Builder.Connections.Seed, Steps = TotalSteps, @@ -206,9 +196,7 @@ public partial class SamplerCardViewModel new ComfyNodeBuilder.KSamplerAdvanced { Name = "Refiner_Sampler", - Model = - e.Builder.Connections.RefinerModel - ?? throw new ArgumentException("No RefinerModel"), + Model = e.Builder.Connections.RefinerModel ?? throw new ArgumentException("No RefinerModel"), AddNoise = false, NoiseSeed = e.Builder.Connections.Seed, Steps = TotalSteps, @@ -254,18 +242,11 @@ public partial class SamplerCardViewModel if ( !string.IsNullOrEmpty(parameters.Sampler) - && GenerationParametersConverter.TryGetSamplerScheduler( - parameters.Sampler, - out var samplerScheduler - ) + && GenerationParametersConverter.TryGetSamplerScheduler(parameters.Sampler, out var samplerScheduler) ) { - SelectedSampler = ClientManager.Samplers.FirstOrDefault( - s => s == samplerScheduler.Sampler - ); - SelectedScheduler = ClientManager.Schedulers.FirstOrDefault( - s => s == samplerScheduler.Scheduler - ); + SelectedSampler = ClientManager.Samplers.FirstOrDefault(s => s == samplerScheduler.Sampler); + SelectedScheduler = ClientManager.Schedulers.FirstOrDefault(s => s == samplerScheduler.Scheduler); } }