Skip to content

Commit c471978

Browse files
authored
Update InferenceImageOutpaintViewModel.cs
Auto select
1 parent 7c9333c commit c471978

1 file changed

Lines changed: 38 additions & 18 deletions

File tree

StabilityMatrix.Avalonia/ViewModels/Inference/InferenceImageOutpaintViewModel.cs

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,19 @@ public bool SmartOutpaintAssistEnabled
8383
}
8484

8585
private double _smartOutpaintInjectionStrength = 0.7;
86+
// --- Debug Prompt Overlay ---
87+
[ObservableProperty]
88+
private bool showDebugPrompt;
89+
90+
[ObservableProperty]
91+
private string? debugFinalPositive;
92+
93+
[ObservableProperty]
94+
private string? debugFinalNegative;
95+
96+
[ObservableProperty]
97+
private string? debugFinalModelName;
98+
8699
public double SmartOutpaintInjectionStrength
87100
{
88101
get => _smartOutpaintInjectionStrength;
@@ -271,28 +284,35 @@ protected override void BuildPrompt(BuildPromptEventArgs args)
271284
// === SMART OUTPAINT ASSIST ===
272285
if (SmartOutpaintAssistEnabled)
273286
{
274-
// Create smart outpaint injection
275-
var injection = PromptInjectionOutpaint.Build(
276-
outpaintCard?.ExpandLeft ?? 0,
277-
outpaintCard?.ExpandRight ?? 0,
278-
outpaintCard?.ExpandTop ?? 0,
279-
outpaintCard?.ExpandBottom ?? 0,
280-
SmartOutpaintInjectionStrength
281-
);
287+
var modelCard = StackCardViewModel.GetCard<ModelCardViewModel>();
288+
var modelName = modelCard?.SelectedModel?.ShortDisplayName ?? "";
289+
var availableModels = ClientManager.Models.Select(m => m.ShortDisplayName ?? m.RelativePath);
282290

283-
// Add injection to prompts
284-
if (!string.IsNullOrWhiteSpace(injection.Positive))
291+
var gp = new GenerationParameters
285292
{
286-
positiveText = (positiveText + injection.Positive).Trim();
287-
Console.WriteLine($"🧠 SmartOutpaintAssist Positive: {injection.Positive}");
288-
}
293+
OutpaintLeft = outpaintCard?.ExpandLeft ?? 0,
294+
OutpaintRight = outpaintCard?.ExpandRight ?? 0,
295+
OutpaintTop = outpaintCard?.ExpandTop ?? 0,
296+
OutpaintBottom = outpaintCard?.ExpandBottom ?? 0,
297+
SmartOutpaintInjectionStrength = SmartOutpaintInjectionStrength,
298+
SceneType = SceneType.Unknown,
299+
AvailableModels = availableModels
300+
};
301+
302+
PromptInjectionOutpaint.ApplyOutpaintPromptInjection(
303+
gp,
304+
modelName,
305+
availableModels,
306+
ref positiveText,
307+
ref negativeText
308+
);
289309

290-
if (!string.IsNullOrWhiteSpace(injection.Negative))
291-
{
292-
negativeText = (negativeText + injection.Negative).Trim();
293-
Console.WriteLine($"🧠 SmartOutpaintAssist Negative: {injection.Negative}");
294-
}
310+
// Save debug output
311+
DebugFinalPositive = gp.DebugFinalPositive;
312+
DebugFinalNegative = gp.DebugFinalNegative;
313+
DebugFinalModelName = gp.DebugFinalModelName;
295314
}
315+
296316

297317
// --- PROMPTS ---
298318
var prompt = nodes.AddTypedNode(new ComfyNodeBuilder.CLIPTextEncode

0 commit comments

Comments
 (0)