Skip to content

Commit c1de129

Browse files
fix(ui): use refiner's seamless node for i2l VAE
Closes #5995
1 parent bf85234 commit c1de129

File tree

1 file changed

+45
-6
lines changed

1 file changed

+45
-6
lines changed

invokeai/frontend/web/src/features/nodes/util/graph/addVAEToGraph.ts

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
SDXL_CANVAS_TEXT_TO_IMAGE_GRAPH,
1919
SDXL_IMAGE_TO_IMAGE_GRAPH,
2020
SDXL_REFINER_INPAINT_CREATE_MASK,
21+
SDXL_REFINER_SEAMLESS,
2122
SDXL_TEXT_TO_IMAGE_GRAPH,
2223
SEAMLESS,
2324
TEXT_TO_IMAGE_GRAPH,
@@ -38,6 +39,8 @@ export const addVAEToGraph = async (
3839

3940
const isAutoVae = !vae;
4041
const isSeamlessEnabled = seamlessXAxis || seamlessYAxis;
42+
const isSDXL = Boolean(graph.id?.includes('sdxl'));
43+
const isUsingRefiner = isSDXL && Boolean(refinerModel);
4144

4245
if (!isAutoVae && !isSeamlessEnabled) {
4346
graph.nodes[VAE_LOADER] = {
@@ -56,7 +59,13 @@ export const addVAEToGraph = async (
5659
) {
5760
graph.edges.push({
5861
source: {
59-
node_id: isSeamlessEnabled ? SEAMLESS : isAutoVae ? modelLoaderNodeId : VAE_LOADER,
62+
node_id: isSeamlessEnabled
63+
? isUsingRefiner
64+
? SDXL_REFINER_SEAMLESS
65+
: SEAMLESS
66+
: isAutoVae
67+
? modelLoaderNodeId
68+
: VAE_LOADER,
6069
field: 'vae',
6170
},
6271
destination: {
@@ -74,7 +83,13 @@ export const addVAEToGraph = async (
7483
) {
7584
graph.edges.push({
7685
source: {
77-
node_id: isSeamlessEnabled ? SEAMLESS : isAutoVae ? modelLoaderNodeId : VAE_LOADER,
86+
node_id: isSeamlessEnabled
87+
? isUsingRefiner
88+
? SDXL_REFINER_SEAMLESS
89+
: SEAMLESS
90+
: isAutoVae
91+
? modelLoaderNodeId
92+
: VAE_LOADER,
7893
field: 'vae',
7994
},
8095
destination: {
@@ -92,7 +107,13 @@ export const addVAEToGraph = async (
92107
) {
93108
graph.edges.push({
94109
source: {
95-
node_id: isSeamlessEnabled ? SEAMLESS : isAutoVae ? modelLoaderNodeId : VAE_LOADER,
110+
node_id: isSeamlessEnabled
111+
? isUsingRefiner
112+
? SDXL_REFINER_SEAMLESS
113+
: SEAMLESS
114+
: isAutoVae
115+
? modelLoaderNodeId
116+
: VAE_LOADER,
96117
field: 'vae',
97118
},
98119
destination: {
@@ -111,7 +132,13 @@ export const addVAEToGraph = async (
111132
graph.edges.push(
112133
{
113134
source: {
114-
node_id: isSeamlessEnabled ? SEAMLESS : isAutoVae ? modelLoaderNodeId : VAE_LOADER,
135+
node_id: isSeamlessEnabled
136+
? isUsingRefiner
137+
? SDXL_REFINER_SEAMLESS
138+
: SEAMLESS
139+
: isAutoVae
140+
? modelLoaderNodeId
141+
: VAE_LOADER,
115142
field: 'vae',
116143
},
117144
destination: {
@@ -122,7 +149,13 @@ export const addVAEToGraph = async (
122149

123150
{
124151
source: {
125-
node_id: isSeamlessEnabled ? SEAMLESS : isAutoVae ? modelLoaderNodeId : VAE_LOADER,
152+
node_id: isSeamlessEnabled
153+
? isUsingRefiner
154+
? SDXL_REFINER_SEAMLESS
155+
: SEAMLESS
156+
: isAutoVae
157+
? modelLoaderNodeId
158+
: VAE_LOADER,
126159
field: 'vae',
127160
},
128161
destination: {
@@ -137,7 +170,13 @@ export const addVAEToGraph = async (
137170
if (graph.id === SDXL_CANVAS_INPAINT_GRAPH || graph.id === SDXL_CANVAS_OUTPAINT_GRAPH) {
138171
graph.edges.push({
139172
source: {
140-
node_id: isSeamlessEnabled ? SEAMLESS : isAutoVae ? modelLoaderNodeId : VAE_LOADER,
173+
node_id: isSeamlessEnabled
174+
? isUsingRefiner
175+
? SDXL_REFINER_SEAMLESS
176+
: SEAMLESS
177+
: isAutoVae
178+
? modelLoaderNodeId
179+
: VAE_LOADER,
141180
field: 'vae',
142181
},
143182
destination: {

0 commit comments

Comments
 (0)