|
|
@ -65,6 +65,12 @@ public partial class InferenceClientManager : ObservableObject, IInferenceClient |
|
|
|
public IObservableCollection<HybridModelFile> VaeModels { get; } = |
|
|
|
public IObservableCollection<HybridModelFile> VaeModels { get; } = |
|
|
|
new ObservableCollectionExtended<HybridModelFile>(); |
|
|
|
new ObservableCollectionExtended<HybridModelFile>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private readonly SourceCache<HybridModelFile, string> controlNetModelsSource = |
|
|
|
|
|
|
|
new(p => p.GetId()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public IObservableCollection<HybridModelFile> ControlNetModels { get; } = |
|
|
|
|
|
|
|
new ObservableCollectionExtended<HybridModelFile>(); |
|
|
|
|
|
|
|
|
|
|
|
private readonly SourceCache<ComfySampler, string> samplersSource = new(p => p.Name); |
|
|
|
private readonly SourceCache<ComfySampler, string> samplersSource = new(p => p.Name); |
|
|
|
|
|
|
|
|
|
|
|
public IObservableCollection<ComfySampler> Samplers { get; } = |
|
|
|
public IObservableCollection<ComfySampler> Samplers { get; } = |
|
|
@ -110,6 +116,17 @@ public partial class InferenceClientManager : ObservableObject, IInferenceClient |
|
|
|
.Bind(Models) |
|
|
|
.Bind(Models) |
|
|
|
.Subscribe(); |
|
|
|
.Subscribe(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
controlNetModelsSource |
|
|
|
|
|
|
|
.Connect() |
|
|
|
|
|
|
|
.SortBy( |
|
|
|
|
|
|
|
f => f.ShortDisplayName, |
|
|
|
|
|
|
|
SortDirection.Ascending, |
|
|
|
|
|
|
|
SortOptimisations.ComparesImmutableValuesOnly |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
.DeferUntilLoaded() |
|
|
|
|
|
|
|
.Bind(ControlNetModels) |
|
|
|
|
|
|
|
.Subscribe(); |
|
|
|
|
|
|
|
|
|
|
|
vaeModelsDefaults.AddOrUpdate(HybridModelFile.Default); |
|
|
|
vaeModelsDefaults.AddOrUpdate(HybridModelFile.Default); |
|
|
|
|
|
|
|
|
|
|
|
vaeModelsDefaults.Connect().Or(vaeModelsSource.Connect()).Bind(VaeModels).Subscribe(); |
|
|
|
vaeModelsDefaults.Connect().Or(vaeModelsSource.Connect()).Bind(VaeModels).Subscribe(); |
|
|
@ -159,6 +176,7 @@ public partial class InferenceClientManager : ObservableObject, IInferenceClient |
|
|
|
if (!IsConnected) |
|
|
|
if (!IsConnected) |
|
|
|
throw new InvalidOperationException("Client is not connected"); |
|
|
|
throw new InvalidOperationException("Client is not connected"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get model names |
|
|
|
if (await Client.GetModelNamesAsync() is { } modelNames) |
|
|
|
if (await Client.GetModelNamesAsync() is { } modelNames) |
|
|
|
{ |
|
|
|
{ |
|
|
|
modelsSource.EditDiff( |
|
|
|
modelsSource.EditDiff( |
|
|
@ -167,6 +185,18 @@ public partial class InferenceClientManager : ObservableObject, IInferenceClient |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get control net model names |
|
|
|
|
|
|
|
if ( |
|
|
|
|
|
|
|
await Client.GetNodeOptionNamesAsync("ControlNetLoader", "control_net_name") is |
|
|
|
|
|
|
|
{ } controlNetModelNames |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
controlNetModelsSource.EditDiff( |
|
|
|
|
|
|
|
controlNetModelNames.Select(HybridModelFile.FromRemote), |
|
|
|
|
|
|
|
HybridModelFile.Comparer |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Fetch sampler names from KSampler node |
|
|
|
// Fetch sampler names from KSampler node |
|
|
|
if (await Client.GetSamplerNamesAsync() is { } samplerNames) |
|
|
|
if (await Client.GetSamplerNamesAsync() is { } samplerNames) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -229,6 +259,14 @@ public partial class InferenceClientManager : ObservableObject, IInferenceClient |
|
|
|
HybridModelFile.Comparer |
|
|
|
HybridModelFile.Comparer |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Load local control net models |
|
|
|
|
|
|
|
controlNetModelsSource.EditDiff( |
|
|
|
|
|
|
|
modelIndexService |
|
|
|
|
|
|
|
.GetFromModelIndex(SharedFolderType.ControlNet) |
|
|
|
|
|
|
|
.Select(HybridModelFile.FromLocal), |
|
|
|
|
|
|
|
HybridModelFile.Comparer |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// Load local VAE models |
|
|
|
// Load local VAE models |
|
|
|
vaeModelsSource.EditDiff( |
|
|
|
vaeModelsSource.EditDiff( |
|
|
|
modelIndexService |
|
|
|
modelIndexService |
|
|
|