mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat: Make SDXL Style Prompt not take spaces
This commit is contained in:
parent
561951ad98
commit
90fa3eebb3
@ -16,18 +16,16 @@ import {
|
|||||||
SDXL_REFINER_NEGATIVE_CONDITIONING,
|
SDXL_REFINER_NEGATIVE_CONDITIONING,
|
||||||
SDXL_REFINER_POSITIVE_CONDITIONING,
|
SDXL_REFINER_POSITIVE_CONDITIONING,
|
||||||
} from './constants';
|
} from './constants';
|
||||||
|
import { craftSDXLStylePrompt } from './helpers/craftSDXLStylePrompt';
|
||||||
|
|
||||||
export const addSDXLRefinerToGraph = (
|
export const addSDXLRefinerToGraph = (
|
||||||
state: RootState,
|
state: RootState,
|
||||||
graph: NonNullableGraph,
|
graph: NonNullableGraph,
|
||||||
baseNodeId: string
|
baseNodeId: string
|
||||||
): void => {
|
): void => {
|
||||||
const { positivePrompt, negativePrompt } = state.generation;
|
|
||||||
const {
|
const {
|
||||||
refinerModel,
|
refinerModel,
|
||||||
refinerAestheticScore,
|
refinerAestheticScore,
|
||||||
positiveStylePrompt,
|
|
||||||
negativeStylePrompt,
|
|
||||||
refinerSteps,
|
refinerSteps,
|
||||||
refinerScheduler,
|
refinerScheduler,
|
||||||
refinerCFGScale,
|
refinerCFGScale,
|
||||||
@ -49,6 +47,10 @@ export const addSDXLRefinerToGraph = (
|
|||||||
metadataAccumulator.refiner_steps = refinerSteps;
|
metadataAccumulator.refiner_steps = refinerSteps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Construct Style Prompt
|
||||||
|
const { craftedPositiveStylePrompt, craftedNegativeStylePrompt } =
|
||||||
|
craftSDXLStylePrompt(state, true);
|
||||||
|
|
||||||
// Unplug SDXL Latents Generation To Latents To Image
|
// Unplug SDXL Latents Generation To Latents To Image
|
||||||
graph.edges = graph.edges.filter(
|
graph.edges = graph.edges.filter(
|
||||||
(e) =>
|
(e) =>
|
||||||
@ -71,13 +73,13 @@ export const addSDXLRefinerToGraph = (
|
|||||||
graph.nodes[SDXL_REFINER_POSITIVE_CONDITIONING] = {
|
graph.nodes[SDXL_REFINER_POSITIVE_CONDITIONING] = {
|
||||||
type: 'sdxl_refiner_compel_prompt',
|
type: 'sdxl_refiner_compel_prompt',
|
||||||
id: SDXL_REFINER_POSITIVE_CONDITIONING,
|
id: SDXL_REFINER_POSITIVE_CONDITIONING,
|
||||||
style: `${positivePrompt} ${positiveStylePrompt}`,
|
style: craftedPositiveStylePrompt,
|
||||||
aesthetic_score: refinerAestheticScore,
|
aesthetic_score: refinerAestheticScore,
|
||||||
};
|
};
|
||||||
graph.nodes[SDXL_REFINER_NEGATIVE_CONDITIONING] = {
|
graph.nodes[SDXL_REFINER_NEGATIVE_CONDITIONING] = {
|
||||||
type: 'sdxl_refiner_compel_prompt',
|
type: 'sdxl_refiner_compel_prompt',
|
||||||
id: SDXL_REFINER_NEGATIVE_CONDITIONING,
|
id: SDXL_REFINER_NEGATIVE_CONDITIONING,
|
||||||
style: `${negativePrompt} ${negativeStylePrompt}`,
|
style: craftedNegativeStylePrompt,
|
||||||
aesthetic_score: refinerAestheticScore,
|
aesthetic_score: refinerAestheticScore,
|
||||||
};
|
};
|
||||||
graph.nodes[SDXL_REFINER_DENOISE_LATENTS] = {
|
graph.nodes[SDXL_REFINER_DENOISE_LATENTS] = {
|
||||||
|
@ -26,6 +26,7 @@ import {
|
|||||||
SDXL_DENOISE_LATENTS,
|
SDXL_DENOISE_LATENTS,
|
||||||
SDXL_MODEL_LOADER,
|
SDXL_MODEL_LOADER,
|
||||||
} from './constants';
|
} from './constants';
|
||||||
|
import { craftSDXLStylePrompt } from './helpers/craftSDXLStylePrompt';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the Canvas tab's Image to Image graph.
|
* Builds the Canvas tab's Image to Image graph.
|
||||||
@ -49,12 +50,10 @@ export const buildCanvasSDXLImageToImageGraph = (
|
|||||||
} = state.generation;
|
} = state.generation;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
positiveStylePrompt,
|
|
||||||
negativeStylePrompt,
|
|
||||||
shouldConcatSDXLStylePrompt,
|
|
||||||
shouldUseSDXLRefiner,
|
shouldUseSDXLRefiner,
|
||||||
refinerStart,
|
refinerStart,
|
||||||
sdxlImg2ImgDenoisingStrength: strength,
|
sdxlImg2ImgDenoisingStrength: strength,
|
||||||
|
shouldConcatSDXLStylePrompt,
|
||||||
} = state.sdxl;
|
} = state.sdxl;
|
||||||
|
|
||||||
// The bounding box determines width and height, not the width and height params
|
// The bounding box determines width and height, not the width and height params
|
||||||
@ -71,6 +70,10 @@ export const buildCanvasSDXLImageToImageGraph = (
|
|||||||
? shouldUseCpuNoise
|
? shouldUseCpuNoise
|
||||||
: initialGenerationState.shouldUseCpuNoise;
|
: initialGenerationState.shouldUseCpuNoise;
|
||||||
|
|
||||||
|
// Construct Style Prompt
|
||||||
|
const { craftedPositiveStylePrompt, craftedNegativeStylePrompt } =
|
||||||
|
craftSDXLStylePrompt(state, shouldConcatSDXLStylePrompt);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The easiest way to build linear graphs is to do it in the node editor, then copy and paste the
|
* The easiest way to build linear graphs is to do it in the node editor, then copy and paste the
|
||||||
* full graph here as a template. Then use the parameters from app state and set friendlier node
|
* full graph here as a template. Then use the parameters from app state and set friendlier node
|
||||||
@ -93,17 +96,13 @@ export const buildCanvasSDXLImageToImageGraph = (
|
|||||||
type: 'sdxl_compel_prompt',
|
type: 'sdxl_compel_prompt',
|
||||||
id: POSITIVE_CONDITIONING,
|
id: POSITIVE_CONDITIONING,
|
||||||
prompt: positivePrompt,
|
prompt: positivePrompt,
|
||||||
style: shouldConcatSDXLStylePrompt
|
style: craftedPositiveStylePrompt,
|
||||||
? `${positivePrompt} ${positiveStylePrompt}`
|
|
||||||
: positiveStylePrompt,
|
|
||||||
},
|
},
|
||||||
[NEGATIVE_CONDITIONING]: {
|
[NEGATIVE_CONDITIONING]: {
|
||||||
type: 'sdxl_compel_prompt',
|
type: 'sdxl_compel_prompt',
|
||||||
id: NEGATIVE_CONDITIONING,
|
id: NEGATIVE_CONDITIONING,
|
||||||
prompt: negativePrompt,
|
prompt: negativePrompt,
|
||||||
style: shouldConcatSDXLStylePrompt
|
style: craftedNegativeStylePrompt,
|
||||||
? `${negativePrompt} ${negativeStylePrompt}`
|
|
||||||
: negativeStylePrompt,
|
|
||||||
},
|
},
|
||||||
[NOISE]: {
|
[NOISE]: {
|
||||||
type: 'noise',
|
type: 'noise',
|
||||||
|
@ -35,6 +35,7 @@ import {
|
|||||||
SDXL_DENOISE_LATENTS,
|
SDXL_DENOISE_LATENTS,
|
||||||
SDXL_MODEL_LOADER,
|
SDXL_MODEL_LOADER,
|
||||||
} from './constants';
|
} from './constants';
|
||||||
|
import { craftSDXLStylePrompt } from './helpers/craftSDXLStylePrompt';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the Canvas tab's Inpaint graph.
|
* Builds the Canvas tab's Inpaint graph.
|
||||||
@ -63,13 +64,8 @@ export const buildCanvasSDXLInpaintGraph = (
|
|||||||
maskBlurMethod,
|
maskBlurMethod,
|
||||||
} = state.generation;
|
} = state.generation;
|
||||||
|
|
||||||
const {
|
const { shouldUseSDXLRefiner, refinerStart, shouldConcatSDXLStylePrompt } =
|
||||||
positiveStylePrompt,
|
state.sdxl;
|
||||||
negativeStylePrompt,
|
|
||||||
shouldConcatSDXLStylePrompt,
|
|
||||||
shouldUseSDXLRefiner,
|
|
||||||
refinerStart,
|
|
||||||
} = state.sdxl;
|
|
||||||
|
|
||||||
if (!model) {
|
if (!model) {
|
||||||
log.error('No model found in state');
|
log.error('No model found in state');
|
||||||
@ -90,6 +86,10 @@ export const buildCanvasSDXLInpaintGraph = (
|
|||||||
? shouldUseCpuNoise
|
? shouldUseCpuNoise
|
||||||
: shouldUseCpuNoise;
|
: shouldUseCpuNoise;
|
||||||
|
|
||||||
|
// Construct Style Prompt
|
||||||
|
const { craftedPositiveStylePrompt, craftedNegativeStylePrompt } =
|
||||||
|
craftSDXLStylePrompt(state, shouldConcatSDXLStylePrompt);
|
||||||
|
|
||||||
const graph: NonNullableGraph = {
|
const graph: NonNullableGraph = {
|
||||||
id: SDXL_CANVAS_INPAINT_GRAPH,
|
id: SDXL_CANVAS_INPAINT_GRAPH,
|
||||||
nodes: {
|
nodes: {
|
||||||
@ -102,17 +102,13 @@ export const buildCanvasSDXLInpaintGraph = (
|
|||||||
type: 'sdxl_compel_prompt',
|
type: 'sdxl_compel_prompt',
|
||||||
id: POSITIVE_CONDITIONING,
|
id: POSITIVE_CONDITIONING,
|
||||||
prompt: positivePrompt,
|
prompt: positivePrompt,
|
||||||
style: shouldConcatSDXLStylePrompt
|
style: craftedPositiveStylePrompt,
|
||||||
? `${positivePrompt} ${positiveStylePrompt}`
|
|
||||||
: positiveStylePrompt,
|
|
||||||
},
|
},
|
||||||
[NEGATIVE_CONDITIONING]: {
|
[NEGATIVE_CONDITIONING]: {
|
||||||
type: 'sdxl_compel_prompt',
|
type: 'sdxl_compel_prompt',
|
||||||
id: NEGATIVE_CONDITIONING,
|
id: NEGATIVE_CONDITIONING,
|
||||||
prompt: negativePrompt,
|
prompt: negativePrompt,
|
||||||
style: shouldConcatSDXLStylePrompt
|
style: craftedNegativeStylePrompt,
|
||||||
? `${negativePrompt} ${negativeStylePrompt}`
|
|
||||||
: negativeStylePrompt,
|
|
||||||
},
|
},
|
||||||
[MASK_BLUR]: {
|
[MASK_BLUR]: {
|
||||||
type: 'img_blur',
|
type: 'img_blur',
|
||||||
|
@ -41,6 +41,7 @@ import {
|
|||||||
SDXL_DENOISE_LATENTS,
|
SDXL_DENOISE_LATENTS,
|
||||||
SDXL_MODEL_LOADER,
|
SDXL_MODEL_LOADER,
|
||||||
} from './constants';
|
} from './constants';
|
||||||
|
import { craftSDXLStylePrompt } from './helpers/craftSDXLStylePrompt';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the Canvas tab's Outpaint graph.
|
* Builds the Canvas tab's Outpaint graph.
|
||||||
@ -71,13 +72,8 @@ export const buildCanvasSDXLOutpaintGraph = (
|
|||||||
infillMethod,
|
infillMethod,
|
||||||
} = state.generation;
|
} = state.generation;
|
||||||
|
|
||||||
const {
|
const { shouldUseSDXLRefiner, refinerStart, shouldConcatSDXLStylePrompt } =
|
||||||
positiveStylePrompt,
|
state.sdxl;
|
||||||
negativeStylePrompt,
|
|
||||||
shouldConcatSDXLStylePrompt,
|
|
||||||
shouldUseSDXLRefiner,
|
|
||||||
refinerStart,
|
|
||||||
} = state.sdxl;
|
|
||||||
|
|
||||||
if (!model) {
|
if (!model) {
|
||||||
log.error('No model found in state');
|
log.error('No model found in state');
|
||||||
@ -98,6 +94,10 @@ export const buildCanvasSDXLOutpaintGraph = (
|
|||||||
? shouldUseCpuNoise
|
? shouldUseCpuNoise
|
||||||
: shouldUseCpuNoise;
|
: shouldUseCpuNoise;
|
||||||
|
|
||||||
|
// Construct Style Prompt
|
||||||
|
const { craftedPositiveStylePrompt, craftedNegativeStylePrompt } =
|
||||||
|
craftSDXLStylePrompt(state, shouldConcatSDXLStylePrompt);
|
||||||
|
|
||||||
const graph: NonNullableGraph = {
|
const graph: NonNullableGraph = {
|
||||||
id: SDXL_CANVAS_OUTPAINT_GRAPH,
|
id: SDXL_CANVAS_OUTPAINT_GRAPH,
|
||||||
nodes: {
|
nodes: {
|
||||||
@ -110,17 +110,13 @@ export const buildCanvasSDXLOutpaintGraph = (
|
|||||||
type: 'sdxl_compel_prompt',
|
type: 'sdxl_compel_prompt',
|
||||||
id: POSITIVE_CONDITIONING,
|
id: POSITIVE_CONDITIONING,
|
||||||
prompt: positivePrompt,
|
prompt: positivePrompt,
|
||||||
style: shouldConcatSDXLStylePrompt
|
style: craftedPositiveStylePrompt,
|
||||||
? `${positivePrompt} ${positiveStylePrompt}`
|
|
||||||
: positiveStylePrompt,
|
|
||||||
},
|
},
|
||||||
[NEGATIVE_CONDITIONING]: {
|
[NEGATIVE_CONDITIONING]: {
|
||||||
type: 'sdxl_compel_prompt',
|
type: 'sdxl_compel_prompt',
|
||||||
id: NEGATIVE_CONDITIONING,
|
id: NEGATIVE_CONDITIONING,
|
||||||
prompt: negativePrompt,
|
prompt: negativePrompt,
|
||||||
style: shouldConcatSDXLStylePrompt
|
style: craftedNegativeStylePrompt,
|
||||||
? `${negativePrompt} ${negativeStylePrompt}`
|
|
||||||
: negativeStylePrompt,
|
|
||||||
},
|
},
|
||||||
[MASK_FROM_ALPHA]: {
|
[MASK_FROM_ALPHA]: {
|
||||||
type: 'tomask',
|
type: 'tomask',
|
||||||
|
@ -24,6 +24,7 @@ import {
|
|||||||
SDXL_DENOISE_LATENTS,
|
SDXL_DENOISE_LATENTS,
|
||||||
SDXL_MODEL_LOADER,
|
SDXL_MODEL_LOADER,
|
||||||
} from './constants';
|
} from './constants';
|
||||||
|
import { craftSDXLStylePrompt } from './helpers/craftSDXLStylePrompt';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the Canvas tab's Text to Image graph.
|
* Builds the Canvas tab's Text to Image graph.
|
||||||
@ -50,13 +51,8 @@ export const buildCanvasSDXLTextToImageGraph = (
|
|||||||
|
|
||||||
const { shouldAutoSave } = state.canvas;
|
const { shouldAutoSave } = state.canvas;
|
||||||
|
|
||||||
const {
|
const { shouldUseSDXLRefiner, refinerStart, shouldConcatSDXLStylePrompt } =
|
||||||
positiveStylePrompt,
|
state.sdxl;
|
||||||
negativeStylePrompt,
|
|
||||||
shouldConcatSDXLStylePrompt,
|
|
||||||
shouldUseSDXLRefiner,
|
|
||||||
refinerStart,
|
|
||||||
} = state.sdxl;
|
|
||||||
|
|
||||||
if (!model) {
|
if (!model) {
|
||||||
log.error('No model found in state');
|
log.error('No model found in state');
|
||||||
@ -97,6 +93,11 @@ export const buildCanvasSDXLTextToImageGraph = (
|
|||||||
denoising_start: 0,
|
denoising_start: 0,
|
||||||
denoising_end: shouldUseSDXLRefiner ? refinerStart : 1,
|
denoising_end: shouldUseSDXLRefiner ? refinerStart : 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Construct Style Prompt
|
||||||
|
const { craftedPositiveStylePrompt, craftedNegativeStylePrompt } =
|
||||||
|
craftSDXLStylePrompt(state, shouldConcatSDXLStylePrompt);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The easiest way to build linear graphs is to do it in the node editor, then copy and paste the
|
* The easiest way to build linear graphs is to do it in the node editor, then copy and paste the
|
||||||
* full graph here as a template. Then use the parameters from app state and set friendlier node
|
* full graph here as a template. Then use the parameters from app state and set friendlier node
|
||||||
@ -122,18 +123,14 @@ export const buildCanvasSDXLTextToImageGraph = (
|
|||||||
id: POSITIVE_CONDITIONING,
|
id: POSITIVE_CONDITIONING,
|
||||||
is_intermediate: true,
|
is_intermediate: true,
|
||||||
prompt: positivePrompt,
|
prompt: positivePrompt,
|
||||||
style: shouldConcatSDXLStylePrompt
|
style: craftedPositiveStylePrompt,
|
||||||
? `${positivePrompt} ${positiveStylePrompt}`
|
|
||||||
: positiveStylePrompt,
|
|
||||||
},
|
},
|
||||||
[NEGATIVE_CONDITIONING]: {
|
[NEGATIVE_CONDITIONING]: {
|
||||||
type: isUsingOnnxModel ? 'prompt_onnx' : 'sdxl_compel_prompt',
|
type: isUsingOnnxModel ? 'prompt_onnx' : 'sdxl_compel_prompt',
|
||||||
id: NEGATIVE_CONDITIONING,
|
id: NEGATIVE_CONDITIONING,
|
||||||
is_intermediate: true,
|
is_intermediate: true,
|
||||||
prompt: negativePrompt,
|
prompt: negativePrompt,
|
||||||
style: shouldConcatSDXLStylePrompt
|
style: craftedNegativeStylePrompt,
|
||||||
? `${negativePrompt} ${negativeStylePrompt}`
|
|
||||||
: negativeStylePrompt,
|
|
||||||
},
|
},
|
||||||
[NOISE]: {
|
[NOISE]: {
|
||||||
type: 'noise',
|
type: 'noise',
|
||||||
|
@ -25,6 +25,7 @@ import {
|
|||||||
SDXL_IMAGE_TO_IMAGE_GRAPH,
|
SDXL_IMAGE_TO_IMAGE_GRAPH,
|
||||||
SDXL_MODEL_LOADER,
|
SDXL_MODEL_LOADER,
|
||||||
} from './constants';
|
} from './constants';
|
||||||
|
import { craftSDXLStylePrompt } from './helpers/craftSDXLStylePrompt';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the Image to Image tab graph.
|
* Builds the Image to Image tab graph.
|
||||||
@ -82,6 +83,10 @@ export const buildLinearSDXLImageToImageGraph = (
|
|||||||
? shouldUseCpuNoise
|
? shouldUseCpuNoise
|
||||||
: initialGenerationState.shouldUseCpuNoise;
|
: initialGenerationState.shouldUseCpuNoise;
|
||||||
|
|
||||||
|
// Construct Style Prompt
|
||||||
|
const { craftedPositiveStylePrompt, craftedNegativeStylePrompt } =
|
||||||
|
craftSDXLStylePrompt(state, shouldConcatSDXLStylePrompt);
|
||||||
|
|
||||||
// copy-pasted graph from node editor, filled in with state values & friendly node ids
|
// copy-pasted graph from node editor, filled in with state values & friendly node ids
|
||||||
const graph: NonNullableGraph = {
|
const graph: NonNullableGraph = {
|
||||||
id: SDXL_IMAGE_TO_IMAGE_GRAPH,
|
id: SDXL_IMAGE_TO_IMAGE_GRAPH,
|
||||||
@ -95,17 +100,13 @@ export const buildLinearSDXLImageToImageGraph = (
|
|||||||
type: 'sdxl_compel_prompt',
|
type: 'sdxl_compel_prompt',
|
||||||
id: POSITIVE_CONDITIONING,
|
id: POSITIVE_CONDITIONING,
|
||||||
prompt: positivePrompt,
|
prompt: positivePrompt,
|
||||||
style: shouldConcatSDXLStylePrompt
|
style: craftedPositiveStylePrompt,
|
||||||
? `${positivePrompt} ${positiveStylePrompt}`
|
|
||||||
: positiveStylePrompt,
|
|
||||||
},
|
},
|
||||||
[NEGATIVE_CONDITIONING]: {
|
[NEGATIVE_CONDITIONING]: {
|
||||||
type: 'sdxl_compel_prompt',
|
type: 'sdxl_compel_prompt',
|
||||||
id: NEGATIVE_CONDITIONING,
|
id: NEGATIVE_CONDITIONING,
|
||||||
prompt: negativePrompt,
|
prompt: negativePrompt,
|
||||||
style: shouldConcatSDXLStylePrompt
|
style: craftedNegativeStylePrompt,
|
||||||
? `${negativePrompt} ${negativeStylePrompt}`
|
|
||||||
: negativeStylePrompt,
|
|
||||||
},
|
},
|
||||||
[NOISE]: {
|
[NOISE]: {
|
||||||
type: 'noise',
|
type: 'noise',
|
||||||
|
@ -19,6 +19,7 @@ import {
|
|||||||
SDXL_MODEL_LOADER,
|
SDXL_MODEL_LOADER,
|
||||||
SDXL_TEXT_TO_IMAGE_GRAPH,
|
SDXL_TEXT_TO_IMAGE_GRAPH,
|
||||||
} from './constants';
|
} from './constants';
|
||||||
|
import { craftSDXLStylePrompt } from './helpers/craftSDXLStylePrompt';
|
||||||
|
|
||||||
export const buildLinearSDXLTextToImageGraph = (
|
export const buildLinearSDXLTextToImageGraph = (
|
||||||
state: RootState
|
state: RootState
|
||||||
@ -42,8 +43,8 @@ export const buildLinearSDXLTextToImageGraph = (
|
|||||||
const {
|
const {
|
||||||
positiveStylePrompt,
|
positiveStylePrompt,
|
||||||
negativeStylePrompt,
|
negativeStylePrompt,
|
||||||
shouldConcatSDXLStylePrompt,
|
|
||||||
shouldUseSDXLRefiner,
|
shouldUseSDXLRefiner,
|
||||||
|
shouldConcatSDXLStylePrompt,
|
||||||
refinerStart,
|
refinerStart,
|
||||||
} = state.sdxl;
|
} = state.sdxl;
|
||||||
|
|
||||||
@ -56,6 +57,10 @@ export const buildLinearSDXLTextToImageGraph = (
|
|||||||
throw new Error('No model found in state');
|
throw new Error('No model found in state');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Construct Style Prompt
|
||||||
|
const { craftedPositiveStylePrompt, craftedNegativeStylePrompt } =
|
||||||
|
craftSDXLStylePrompt(state, shouldConcatSDXLStylePrompt);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The easiest way to build linear graphs is to do it in the node editor, then copy and paste the
|
* The easiest way to build linear graphs is to do it in the node editor, then copy and paste the
|
||||||
* full graph here as a template. Then use the parameters from app state and set friendlier node
|
* full graph here as a template. Then use the parameters from app state and set friendlier node
|
||||||
@ -78,17 +83,13 @@ export const buildLinearSDXLTextToImageGraph = (
|
|||||||
type: 'sdxl_compel_prompt',
|
type: 'sdxl_compel_prompt',
|
||||||
id: POSITIVE_CONDITIONING,
|
id: POSITIVE_CONDITIONING,
|
||||||
prompt: positivePrompt,
|
prompt: positivePrompt,
|
||||||
style: shouldConcatSDXLStylePrompt
|
style: craftedPositiveStylePrompt,
|
||||||
? `${positivePrompt} ${positiveStylePrompt}`
|
|
||||||
: positiveStylePrompt,
|
|
||||||
},
|
},
|
||||||
[NEGATIVE_CONDITIONING]: {
|
[NEGATIVE_CONDITIONING]: {
|
||||||
type: 'sdxl_compel_prompt',
|
type: 'sdxl_compel_prompt',
|
||||||
id: NEGATIVE_CONDITIONING,
|
id: NEGATIVE_CONDITIONING,
|
||||||
prompt: negativePrompt,
|
prompt: negativePrompt,
|
||||||
style: shouldConcatSDXLStylePrompt
|
style: craftedNegativeStylePrompt,
|
||||||
? `${negativePrompt} ${negativeStylePrompt}`
|
|
||||||
: negativeStylePrompt,
|
|
||||||
},
|
},
|
||||||
[NOISE]: {
|
[NOISE]: {
|
||||||
type: 'noise',
|
type: 'noise',
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
import { RootState } from 'app/store/store';
|
||||||
|
|
||||||
|
export const craftSDXLStylePrompt = (
|
||||||
|
state: RootState,
|
||||||
|
shouldConcatSDXLStylePrompt: boolean
|
||||||
|
) => {
|
||||||
|
const { positivePrompt, negativePrompt } = state.generation;
|
||||||
|
const { positiveStylePrompt, negativeStylePrompt } = state.sdxl;
|
||||||
|
|
||||||
|
let craftedPositiveStylePrompt = positiveStylePrompt;
|
||||||
|
let craftedNegativeStylePrompt = negativeStylePrompt;
|
||||||
|
|
||||||
|
if (shouldConcatSDXLStylePrompt) {
|
||||||
|
if (positiveStylePrompt.length > 0) {
|
||||||
|
craftedPositiveStylePrompt = `${positivePrompt} ${positiveStylePrompt}`;
|
||||||
|
} else {
|
||||||
|
craftedPositiveStylePrompt = positivePrompt;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (negativeStylePrompt.length > 0) {
|
||||||
|
craftedNegativeStylePrompt = `${negativePrompt} ${negativeStylePrompt}`;
|
||||||
|
} else {
|
||||||
|
craftedNegativeStylePrompt = negativePrompt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { craftedPositiveStylePrompt, craftedNegativeStylePrompt };
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user