Skip to content

Commit e2f6c30

Browse files
mohnjilesclaude
andcommitted
Wire model card Shift to Z-Image, reorder refiner row, fix clip override
- Use ModelCardViewModel.Shift for ModelSamplingAuraFlow (Z-Image) instead of hardcoded 3.0 - Show the Shift control for both HiDream and Z-Image workflows - Move Refiner row to sit between Model and Workflow selector - Split RefreshWorkflowProfileState so project load only fires notifications and no longer overwrites a user's encoder type override Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 5b2cd03 commit e2f6c30

3 files changed

Lines changed: 43 additions & 32 deletions

File tree

StabilityMatrix.Avalonia/Controls/Inference/ModelCard.axaml

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,33 @@
111111
</StackPanel>
112112
</Grid>
113113

114+
<!-- Refiner (below Model, when enabled) -->
115+
<Grid
116+
Margin="0,8,0,0"
117+
ColumnDefinitions="70,*,Auto"
118+
IsVisible="{Binding IsRefinerSelectionEnabled}">
119+
<TextBlock
120+
Grid.Column="0"
121+
VerticalAlignment="Center"
122+
Text="{x:Static lang:Resources.Label_Refiner}"
123+
TextAlignment="Left" />
124+
<controls:BetterComboBox
125+
Grid.Column="1"
126+
Padding="8,6,4,6"
127+
HorizontalAlignment="Stretch"
128+
ItemsSource="{Binding ClientManager.Models}"
129+
SelectedItem="{Binding SelectedRefiner}"
130+
Theme="{StaticResource BetterComboBoxHybridModelTheme}" />
131+
<Button
132+
Grid.Column="2"
133+
Margin="4,0,0,0"
134+
VerticalAlignment="Stretch"
135+
Command="{Binding OpenRefinerPickerCommand}"
136+
ToolTip.Tip="Browse all refiner models">
137+
<fluent:SymbolIcon FontSize="16" Symbol="Search" />
138+
</Button>
139+
</Grid>
140+
114141
<!-- Workflow Profile -->
115142
<Grid Margin="0,8,0,0" ColumnDefinitions="70,*,Auto">
116143
<TextBlock
@@ -155,33 +182,6 @@
155182
IsVisible="{Binding ShowWorkflowProfileStatus}"
156183
Text="{Binding WorkflowProfileStatusText}" />
157184

158-
<!-- Refiner (below Model, when enabled) -->
159-
<Grid
160-
Margin="0,8,0,0"
161-
ColumnDefinitions="70,*,Auto"
162-
IsVisible="{Binding IsRefinerSelectionEnabled}">
163-
<TextBlock
164-
Grid.Column="0"
165-
VerticalAlignment="Center"
166-
Text="{x:Static lang:Resources.Label_Refiner}"
167-
TextAlignment="Left" />
168-
<controls:BetterComboBox
169-
Grid.Column="1"
170-
Padding="8,6,4,6"
171-
HorizontalAlignment="Stretch"
172-
ItemsSource="{Binding ClientManager.Models}"
173-
SelectedItem="{Binding SelectedRefiner}"
174-
Theme="{StaticResource BetterComboBoxHybridModelTheme}" />
175-
<Button
176-
Grid.Column="2"
177-
Margin="4,0,0,0"
178-
VerticalAlignment="Stretch"
179-
Command="{Binding OpenRefinerPickerCommand}"
180-
ToolTip.Tip="Browse all refiner models">
181-
<fluent:SymbolIcon FontSize="16" Symbol="Search" />
182-
</Button>
183-
</Grid>
184-
185185
<!-- Advanced Options Expander (Precision, VAE, CLIP Skip) -->
186186
<Expander
187187
Margin="0,8,0,0"

StabilityMatrix.Avalonia/ViewModels/Inference/InferenceTextToImageViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ protected void ApplyModelSamplingForCurrentWorkflow(ModuleApplyStepEventArgs app
311311
{
312312
Name = builder.Nodes.GetUniqueName(nameof(ComfyNodeBuilder.ModelSamplingAuraFlow)),
313313
Model = builder.Connections.Base.Model.Unwrap(),
314-
Shift = 3.0d,
314+
Shift = ModelCardViewModel.Shift,
315315
}
316316
);
317317

StabilityMatrix.Avalonia/ViewModels/Inference/ModelCardViewModel.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ public HybridModelFile? SelectedUnifiedModel
168168
nameof(IsHiDreamClip),
169169
nameof(ResolvedWorkflowProfile),
170170
nameof(IsHiDreamWorkflow),
171+
nameof(IsZImageWorkflow),
171172
nameof(ShowShift),
172173
nameof(ShowEncoderTypeSelection),
173174
nameof(HasRecommendedDefaults),
@@ -181,6 +182,7 @@ public HybridModelFile? SelectedUnifiedModel
181182
[NotifyPropertyChangedFor(
182183
nameof(ResolvedWorkflowProfile),
183184
nameof(IsHiDreamWorkflow),
185+
nameof(IsZImageWorkflow),
184186
nameof(ShowShift),
185187
nameof(ShowEncoderTypeSelection),
186188
nameof(HasRecommendedDefaults),
@@ -242,6 +244,9 @@ public HybridModelFile? SelectedUnifiedModel
242244
public bool IsHiDreamWorkflow =>
243245
ResolvedWorkflowProfile is InferenceWorkflowProfile.HiDream
244246
|| (ResolvedWorkflowProfile is InferenceWorkflowProfile.Custom && SelectedClipType == "HiDream");
247+
public bool IsZImageWorkflow =>
248+
ResolvedWorkflowProfile is InferenceWorkflowProfile.ZImageBase or InferenceWorkflowProfile.ZImageTurbo
249+
|| (ResolvedWorkflowProfile is InferenceWorkflowProfile.Custom && SelectedClipType == "lumina2");
245250
public bool IsGguf => SelectedUnetModel?.RelativePath.EndsWith("gguf") ?? false;
246251

247252
/// <summary>
@@ -272,9 +277,9 @@ public string AdvancedOptionsHeader
272277
public string TextEncodersHeader => $"Text Encoders ({TextEncoders.Count})";
273278

274279
/// <summary>
275-
/// Whether to show the Shift control (for HiDream clip type, only when in UNet mode).
280+
/// Whether to show the Shift control (for HiDream and Z-Image workflows, only when in UNet mode).
276281
/// </summary>
277-
public bool ShowShift => ShowEncoderSection && IsHiDreamWorkflow;
282+
public bool ShowShift => ShowEncoderSection && (IsHiDreamWorkflow || IsZImageWorkflow);
278283
public bool ShowEncoderTypeSelection =>
279284
ShowEncoderSection && SelectedWorkflowProfile is not InferenceWorkflowProfile.Auto;
280285
public InferenceWorkflowProfile ResolvedWorkflowProfile =>
@@ -629,7 +634,7 @@ public override void LoadStateFromJsonObject(JsonObject state)
629634
finally
630635
{
631636
isLoadingState = false;
632-
RefreshWorkflowProfileState();
637+
NotifyWorkflowProfileStateChanged();
633638
}
634639
}
635640

@@ -914,16 +919,22 @@ partial void OnSelectedWorkflowProfileChanged(InferenceWorkflowProfile value)
914919
RefreshWorkflowProfileState();
915920
}
916921

917-
private void RefreshWorkflowProfileState()
922+
private void NotifyWorkflowProfileStateChanged()
918923
{
919924
OnPropertyChanged(nameof(ResolvedWorkflowProfile));
920925
OnPropertyChanged(nameof(IsHiDreamWorkflow));
926+
OnPropertyChanged(nameof(IsZImageWorkflow));
921927
OnPropertyChanged(nameof(ShowShift));
922928
OnPropertyChanged(nameof(ShowEncoderTypeSelection));
923929
OnPropertyChanged(nameof(HasRecommendedDefaults));
924930
OnPropertyChanged(nameof(WorkflowProfileStatusText));
925931
OnPropertyChanged(nameof(ShowWorkflowProfileStatus));
926932
OnPropertyChanged(nameof(RecommendedDefaultsToolTip));
933+
}
934+
935+
private void RefreshWorkflowProfileState()
936+
{
937+
NotifyWorkflowProfileStateChanged();
927938

928939
if (!isLoadingState)
929940
{

0 commit comments

Comments
 (0)