Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio Compare: keep the negative prompt on cells the Detailer pass still uses (#16149)

Daniel Han71229cc93a54
diff --git a/studio/frontend/src/features/images/compare/compare-axes.ts b/studio/frontend/src/features/images/compare/compare-axes.ts
index c024c796a47..1988f3147df 100644
--- a/studio/frontend/src/features/images/compare/compare-axes.ts
+++ b/studio/frontend/src/features/images/compare/compare-axes.ts
@@ -48,6 +48,7 @@ export interface CompareContext {
controlnetEngaged: boolean;
// Hires CFG makes the refine pass read the negative prompt at any base CFG; no axis varies Hires, so it is grid-wide.
hiresEngagesNegative?: boolean;
+ detailerEngagesNegative?: boolean;
}
type Value = number | string;
@@ -400,7 +401,10 @@ function cellProblem(plan: CompareGridPlan, ctx: CompareContext): string | null
function negativeEngaged(ctx: CompareContext, guidance: number): boolean {
return (
ctx.negativeCapable &&
- (ctx.negativeMinGuidance === null || guidance > ctx.negativeMinGuidance || ctx.hiresEngagesNegative === true)
+ (ctx.negativeMinGuidance === null ||
+ guidance > ctx.negativeMinGuidance ||
+ ctx.hiresEngagesNegative === true ||
+ ctx.detailerEngagesNegative === true)
);
}
diff --git a/studio/frontend/src/features/images/images-page.tsx b/studio/frontend/src/features/images/images-page.tsx
index bf6a960feb8..0e2e9acdc4e 100644
--- a/studio/frontend/src/features/images/images-page.tsx
+++ b/studio/frontend/src/features/images/images-page.tsx
@@ -5574,12 +5574,13 @@ export function ImagesPage({
})),
sdControls: compareSdControls,
hiresEngagesNegative: hiresEngagesNegative(hires, hiresCapability, workflow, negativeMinGuidance),
+ detailerEngagesNegative: detailerEngagesNegative(detailerOn, detailerReady, detailerOptions, negativeMinGuidance),
// The predicate the request uses (strength 0 runs plain text-to-image, where CFG rescale applies).
controlnetEngaged,
}),
// samplerChoice is rebuilt every render; its two fields are what matter.
// eslint-disable-next-line react-hooks/exhaustive-deps
- [prompt, negativePrompt, negativeCapable, negativeMinGuidance, guidanceFixed, effectiveGuidance, samplerOptions, samplerChoice.sampler, samplerChoice.scheduleType, shiftControl, loraCapable, loras, availableLoras, compareSdControls, controlnetEngaged, hires, hiresCapability, workflow],
+ [prompt, negativePrompt, negativeCapable, negativeMinGuidance, guidanceFixed, effectiveGuidance, samplerOptions, samplerChoice.sampler, samplerChoice.scheduleType, shiftControl, loraCapable, loras, availableLoras, compareSdControls, controlnetEngaged, hires, hiresCapability, workflow, detailerOn, detailerReady, detailerOptions],
);
const handleGenerateWithRecall = useCallback(async () => {
diff --git a/studio/frontend/tests/images-compare-grid.test.ts b/studio/frontend/tests/images-compare-grid.test.ts
index 33d2ac1da13..3b8e4e0e590 100644
--- a/studio/frontend/tests/images-compare-grid.test.ts
+++ b/studio/frontend/tests/images-compare-grid.test.ts
@@ -964,6 +964,22 @@ test("Hires CFG keeps the negative prompt on a CFG cell whose base guidance leav
assert.equal(gridNegativePrompt(off, { ...sr, negativePrompt: "blurry", hiresEngagesNegative: true }), "blurry");
});
+test("Detailer CFG keeps the negative prompt on a CFG cell whose base guidance leaves it off, as Generate does", () => {
+ const detailer = { guidance: 7 } as never;
+ const g = plan([{ axisId: "guidance", text: "1, 7" }]);
+ const seeds = { base: 1, keepRandom: false, seedFieldEmpty: false };
+ const ctx = sdxl({ detailerEngagesNegative: true });
+ assert.equal(buildCellRequest(g, 0, base({ detailer }), ctx, seeds).negative_prompt, "blurry");
+ assert.equal(buildCellRequest(g, 1, base({ detailer }), ctx, seeds).negative_prompt, "blurry");
+ assert.equal(buildCellRequest(g, 0, base(), sdxl(), seeds).negative_prompt, undefined);
+ const sr = sdxl({ prompt: "a fox", negativePrompt: "red eyes", guidance: 1 });
+ assert.ok(planCompare([{ axisId: "prompt_sr", text: "red, blue" }], { ...sr, detailerEngagesNegative: true }).ok);
+ const off = plan([{ axisId: "steps", text: "10, 20" }], { ...sr, negativePrompt: "blurry" });
+ assert.equal(gridNegativePrompt(off, { ...sr, negativePrompt: "blurry", detailerEngagesNegative: true }), "blurry");
+ const page = readSrc("features/images/images-page.tsx");
+ assert.match(page, /detailerEngagesNegative: detailerEngagesNegative\(detailerOn, detailerReady, detailerOptions, negativeMinGuidance\),/);
+});
+
test("grid metadata records the Hires fix every cell ran, in A1111 names, and drops it when cells differ", () => {
const steps = plan([{ axisId: "steps", text: "10, 20" }]);
const form = { steps: 25, guidance: 6, width: 1024, height: 1024, model: "m" };