Merge branch 'main' into release/invokeai-3-0-1

This commit is contained in:
Lincoln Stein 2023-07-26 13:33:15 -04:00
commit 4f39c81dec
9 changed files with 126 additions and 32 deletions

View File

@ -7,7 +7,9 @@ import {
ImageToLatentsInvocation, ImageToLatentsInvocation,
} from 'services/api/types'; } from 'services/api/types';
import { addDynamicPromptsToGraph } from './addDynamicPromptsToGraph'; import { addDynamicPromptsToGraph } from './addDynamicPromptsToGraph';
import { addNSFWCheckerToGraph } from './addNSFWCheckerToGraph';
import { addSDXLRefinerToGraph } from './addSDXLRefinerToGraph'; import { addSDXLRefinerToGraph } from './addSDXLRefinerToGraph';
import { addWatermarkerToGraph } from './addWatermarkerToGraph';
import { import {
IMAGE_TO_LATENTS, IMAGE_TO_LATENTS,
LATENTS_TO_IMAGE, LATENTS_TO_IMAGE,
@ -20,8 +22,6 @@ import {
SDXL_LATENTS_TO_LATENTS, SDXL_LATENTS_TO_LATENTS,
SDXL_MODEL_LOADER, SDXL_MODEL_LOADER,
} from './constants'; } from './constants';
import { addNSFWCheckerToGraph } from './addNSFWCheckerToGraph';
import { addWatermarkerToGraph } from './addWatermarkerToGraph';
/** /**
* Builds the Image to Image tab graph. * Builds the Image to Image tab graph.
@ -50,6 +50,7 @@ export const buildLinearSDXLImageToImageGraph = (
const { const {
positiveStylePrompt, positiveStylePrompt,
negativeStylePrompt, negativeStylePrompt,
shouldConcatSDXLStylePrompt,
shouldUseSDXLRefiner, shouldUseSDXLRefiner,
refinerStart, refinerStart,
sdxlImg2ImgDenoisingStrength: strength, sdxlImg2ImgDenoisingStrength: strength,
@ -91,13 +92,17 @@ export const buildLinearSDXLImageToImageGraph = (
type: 'sdxl_compel_prompt', type: 'sdxl_compel_prompt',
id: POSITIVE_CONDITIONING, id: POSITIVE_CONDITIONING,
prompt: positivePrompt, prompt: positivePrompt,
style: positiveStylePrompt, style: shouldConcatSDXLStylePrompt
? `${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: negativeStylePrompt, style: shouldConcatSDXLStylePrompt
? `${negativePrompt} ${negativeStylePrompt}`
: negativeStylePrompt,
}, },
[NOISE]: { [NOISE]: {
type: 'noise', type: 'noise',

View File

@ -3,7 +3,9 @@ import { RootState } from 'app/store/store';
import { NonNullableGraph } from 'features/nodes/types/types'; import { NonNullableGraph } from 'features/nodes/types/types';
import { initialGenerationState } from 'features/parameters/store/generationSlice'; import { initialGenerationState } from 'features/parameters/store/generationSlice';
import { addDynamicPromptsToGraph } from './addDynamicPromptsToGraph'; import { addDynamicPromptsToGraph } from './addDynamicPromptsToGraph';
import { addNSFWCheckerToGraph } from './addNSFWCheckerToGraph';
import { addSDXLRefinerToGraph } from './addSDXLRefinerToGraph'; import { addSDXLRefinerToGraph } from './addSDXLRefinerToGraph';
import { addWatermarkerToGraph } from './addWatermarkerToGraph';
import { import {
LATENTS_TO_IMAGE, LATENTS_TO_IMAGE,
METADATA_ACCUMULATOR, METADATA_ACCUMULATOR,
@ -14,8 +16,6 @@ import {
SDXL_TEXT_TO_IMAGE_GRAPH, SDXL_TEXT_TO_IMAGE_GRAPH,
SDXL_TEXT_TO_LATENTS, SDXL_TEXT_TO_LATENTS,
} from './constants'; } from './constants';
import { addNSFWCheckerToGraph } from './addNSFWCheckerToGraph';
import { addWatermarkerToGraph } from './addWatermarkerToGraph';
export const buildLinearSDXLTextToImageGraph = ( export const buildLinearSDXLTextToImageGraph = (
state: RootState state: RootState
@ -39,6 +39,7 @@ export const buildLinearSDXLTextToImageGraph = (
const { const {
positiveStylePrompt, positiveStylePrompt,
negativeStylePrompt, negativeStylePrompt,
shouldConcatSDXLStylePrompt,
shouldUseSDXLRefiner, shouldUseSDXLRefiner,
refinerStart, refinerStart,
} = state.sdxl; } = state.sdxl;
@ -74,13 +75,17 @@ export const buildLinearSDXLTextToImageGraph = (
type: 'sdxl_compel_prompt', type: 'sdxl_compel_prompt',
id: POSITIVE_CONDITIONING, id: POSITIVE_CONDITIONING,
prompt: positivePrompt, prompt: positivePrompt,
style: positiveStylePrompt, style: shouldConcatSDXLStylePrompt
? `${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: negativeStylePrompt, style: shouldConcatSDXLStylePrompt
? `${negativePrompt} ${negativeStylePrompt}`
: negativeStylePrompt,
}, },
[NOISE]: { [NOISE]: {
type: 'noise', type: 'noise',

View File

@ -0,0 +1,33 @@
import { Box } from '@chakra-ui/react';
import { RootState } from 'app/store/store';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import IAISwitch from 'common/components/IAISwitch';
import { ChangeEvent } from 'react';
import { setShouldConcatSDXLStylePrompt } from '../store/sdxlSlice';
export default function ParamSDXLConcatPrompt() {
const shouldConcatSDXLStylePrompt = useAppSelector(
(state: RootState) => state.sdxl.shouldConcatSDXLStylePrompt
);
const dispatch = useAppDispatch();
const handleShouldConcatPromptChange = (e: ChangeEvent<HTMLInputElement>) => {
dispatch(setShouldConcatSDXLStylePrompt(e.target.checked));
};
return (
<Box
sx={{
px: 2,
}}
>
<IAISwitch
label="Concat Style Prompt"
tooltip="Concatenates Basic Prompt with Style (Recommended)"
isChecked={shouldConcatSDXLStylePrompt}
onChange={handleShouldConcatPromptChange}
/>
</Box>
);
}

View File

@ -1,9 +1,10 @@
import { Flex } from '@chakra-ui/react';
import ParamDynamicPromptsCollapse from 'features/dynamicPrompts/components/ParamDynamicPromptsCollapse'; import ParamDynamicPromptsCollapse from 'features/dynamicPrompts/components/ParamDynamicPromptsCollapse';
import ParamNegativeConditioning from 'features/parameters/components/Parameters/Core/ParamNegativeConditioning'; import ParamNegativeConditioning from 'features/parameters/components/Parameters/Core/ParamNegativeConditioning';
import ParamPositiveConditioning from 'features/parameters/components/Parameters/Core/ParamPositiveConditioning'; import ParamPositiveConditioning from 'features/parameters/components/Parameters/Core/ParamPositiveConditioning';
import ParamNoiseCollapse from 'features/parameters/components/Parameters/Noise/ParamNoiseCollapse'; import ParamNoiseCollapse from 'features/parameters/components/Parameters/Noise/ParamNoiseCollapse';
// import ParamVariationCollapse from 'features/parameters/components/Parameters/Variations/ParamVariationCollapse';
import ProcessButtons from 'features/parameters/components/ProcessButtons/ProcessButtons'; import ProcessButtons from 'features/parameters/components/ProcessButtons/ProcessButtons';
import ParamSDXLConcatPrompt from './ParamSDXLConcatPrompt';
import ParamSDXLNegativeStyleConditioning from './ParamSDXLNegativeStyleConditioning'; import ParamSDXLNegativeStyleConditioning from './ParamSDXLNegativeStyleConditioning';
import ParamSDXLPositiveStyleConditioning from './ParamSDXLPositiveStyleConditioning'; import ParamSDXLPositiveStyleConditioning from './ParamSDXLPositiveStyleConditioning';
import ParamSDXLRefinerCollapse from './ParamSDXLRefinerCollapse'; import ParamSDXLRefinerCollapse from './ParamSDXLRefinerCollapse';
@ -12,10 +13,22 @@ import SDXLImageToImageTabCoreParameters from './SDXLImageToImageTabCoreParamete
const SDXLImageToImageTabParameters = () => { const SDXLImageToImageTabParameters = () => {
return ( return (
<> <>
<Flex
sx={{
flexDirection: 'column',
gap: 2,
p: 2,
borderRadius: 4,
bg: 'base.100',
_dark: { bg: 'base.850' },
}}
>
<ParamPositiveConditioning /> <ParamPositiveConditioning />
<ParamSDXLPositiveStyleConditioning /> <ParamSDXLPositiveStyleConditioning />
<ParamNegativeConditioning /> <ParamNegativeConditioning />
<ParamSDXLNegativeStyleConditioning /> <ParamSDXLNegativeStyleConditioning />
<ParamSDXLConcatPrompt />
</Flex>
<ProcessButtons /> <ProcessButtons />
<SDXLImageToImageTabCoreParameters /> <SDXLImageToImageTabCoreParameters />
<ParamSDXLRefinerCollapse /> <ParamSDXLRefinerCollapse />

View File

@ -1,9 +1,11 @@
import { Flex } from '@chakra-ui/react';
import ParamDynamicPromptsCollapse from 'features/dynamicPrompts/components/ParamDynamicPromptsCollapse'; import ParamDynamicPromptsCollapse from 'features/dynamicPrompts/components/ParamDynamicPromptsCollapse';
import ParamNegativeConditioning from 'features/parameters/components/Parameters/Core/ParamNegativeConditioning'; import ParamNegativeConditioning from 'features/parameters/components/Parameters/Core/ParamNegativeConditioning';
import ParamPositiveConditioning from 'features/parameters/components/Parameters/Core/ParamPositiveConditioning'; import ParamPositiveConditioning from 'features/parameters/components/Parameters/Core/ParamPositiveConditioning';
import ParamNoiseCollapse from 'features/parameters/components/Parameters/Noise/ParamNoiseCollapse'; import ParamNoiseCollapse from 'features/parameters/components/Parameters/Noise/ParamNoiseCollapse';
import ProcessButtons from 'features/parameters/components/ProcessButtons/ProcessButtons'; import ProcessButtons from 'features/parameters/components/ProcessButtons/ProcessButtons';
import TextToImageTabCoreParameters from 'features/ui/components/tabs/TextToImage/TextToImageTabCoreParameters'; import TextToImageTabCoreParameters from 'features/ui/components/tabs/TextToImage/TextToImageTabCoreParameters';
import ParamSDXLConcatPrompt from './ParamSDXLConcatPrompt';
import ParamSDXLNegativeStyleConditioning from './ParamSDXLNegativeStyleConditioning'; import ParamSDXLNegativeStyleConditioning from './ParamSDXLNegativeStyleConditioning';
import ParamSDXLPositiveStyleConditioning from './ParamSDXLPositiveStyleConditioning'; import ParamSDXLPositiveStyleConditioning from './ParamSDXLPositiveStyleConditioning';
import ParamSDXLRefinerCollapse from './ParamSDXLRefinerCollapse'; import ParamSDXLRefinerCollapse from './ParamSDXLRefinerCollapse';
@ -11,10 +13,22 @@ import ParamSDXLRefinerCollapse from './ParamSDXLRefinerCollapse';
const SDXLTextToImageTabParameters = () => { const SDXLTextToImageTabParameters = () => {
return ( return (
<> <>
<Flex
sx={{
flexDirection: 'column',
gap: 2,
p: 2,
borderRadius: 4,
bg: 'base.100',
_dark: { bg: 'base.850' },
}}
>
<ParamPositiveConditioning /> <ParamPositiveConditioning />
<ParamSDXLPositiveStyleConditioning /> <ParamSDXLPositiveStyleConditioning />
<ParamNegativeConditioning /> <ParamNegativeConditioning />
<ParamSDXLNegativeStyleConditioning /> <ParamSDXLNegativeStyleConditioning />
<ParamSDXLConcatPrompt />
</Flex>
<ProcessButtons /> <ProcessButtons />
<TextToImageTabCoreParameters /> <TextToImageTabCoreParameters />
<ParamSDXLRefinerCollapse /> <ParamSDXLRefinerCollapse />

View File

@ -10,6 +10,7 @@ import { MainModelField } from 'services/api/types';
type SDXLInitialState = { type SDXLInitialState = {
positiveStylePrompt: PositiveStylePromptSDXLParam; positiveStylePrompt: PositiveStylePromptSDXLParam;
negativeStylePrompt: NegativeStylePromptSDXLParam; negativeStylePrompt: NegativeStylePromptSDXLParam;
shouldConcatSDXLStylePrompt: boolean;
shouldUseSDXLRefiner: boolean; shouldUseSDXLRefiner: boolean;
sdxlImg2ImgDenoisingStrength: number; sdxlImg2ImgDenoisingStrength: number;
refinerModel: MainModelField | null; refinerModel: MainModelField | null;
@ -23,6 +24,7 @@ type SDXLInitialState = {
const sdxlInitialState: SDXLInitialState = { const sdxlInitialState: SDXLInitialState = {
positiveStylePrompt: '', positiveStylePrompt: '',
negativeStylePrompt: '', negativeStylePrompt: '',
shouldConcatSDXLStylePrompt: true,
shouldUseSDXLRefiner: false, shouldUseSDXLRefiner: false,
sdxlImg2ImgDenoisingStrength: 0.7, sdxlImg2ImgDenoisingStrength: 0.7,
refinerModel: null, refinerModel: null,
@ -43,6 +45,9 @@ const sdxlSlice = createSlice({
setNegativeStylePromptSDXL: (state, action: PayloadAction<string>) => { setNegativeStylePromptSDXL: (state, action: PayloadAction<string>) => {
state.negativeStylePrompt = action.payload; state.negativeStylePrompt = action.payload;
}, },
setShouldConcatSDXLStylePrompt: (state, action: PayloadAction<boolean>) => {
state.shouldConcatSDXLStylePrompt = action.payload;
},
setShouldUseSDXLRefiner: (state, action: PayloadAction<boolean>) => { setShouldUseSDXLRefiner: (state, action: PayloadAction<boolean>) => {
state.shouldUseSDXLRefiner = action.payload; state.shouldUseSDXLRefiner = action.payload;
}, },
@ -76,6 +81,7 @@ const sdxlSlice = createSlice({
export const { export const {
setPositiveStylePromptSDXL, setPositiveStylePromptSDXL,
setNegativeStylePromptSDXL, setNegativeStylePromptSDXL,
setShouldConcatSDXLStylePrompt,
setShouldUseSDXLRefiner, setShouldUseSDXLRefiner,
setSDXLImg2ImgDenoisingStrength, setSDXLImg2ImgDenoisingStrength,
refinerModelChanged, refinerModelChanged,

View File

@ -104,6 +104,7 @@ type ConfigOptions = {
shouldShowAdvancedOptionsSettings: boolean; shouldShowAdvancedOptionsSettings: boolean;
shouldShowClearIntermediates: boolean; shouldShowClearIntermediates: boolean;
shouldShowNodesToggle: boolean; shouldShowNodesToggle: boolean;
shouldShowLocalizationToggle: boolean;
}; };
type SettingsModalProps = { type SettingsModalProps = {
@ -125,6 +126,8 @@ const SettingsModal = ({ children, config }: SettingsModalProps) => {
const shouldShowClearIntermediates = const shouldShowClearIntermediates =
config?.shouldShowClearIntermediates ?? true; config?.shouldShowClearIntermediates ?? true;
const shouldShowNodesToggle = config?.shouldShowNodesToggle ?? true; const shouldShowNodesToggle = config?.shouldShowNodesToggle ?? true;
const shouldShowLocalizationToggle =
config?.shouldShowLocalizationToggle ?? true;
useEffect(() => { useEffect(() => {
if (!shouldShowDeveloperSettings) { if (!shouldShowDeveloperSettings) {
@ -325,6 +328,7 @@ const SettingsModal = ({ children, config }: SettingsModalProps) => {
onChange={handleToggleNodes} onChange={handleToggleNodes}
/> />
)} )}
{shouldShowLocalizationToggle && (
<IAIMantineSelect <IAIMantineSelect
disabled={!isLocalizationEnabled} disabled={!isLocalizationEnabled}
label={t('common.languagePickerLabel')} label={t('common.languagePickerLabel')}
@ -335,6 +339,7 @@ const SettingsModal = ({ children, config }: SettingsModalProps) => {
}))} }))}
onChange={handleLanguageChanged} onChange={handleLanguageChanged}
/> />
)}
</StyledFlex> </StyledFlex>
{shouldShowDeveloperSettings && ( {shouldShowDeveloperSettings && (

View File

@ -1,7 +1,10 @@
import { Flex } from '@chakra-ui/react'; import { Flex } from '@chakra-ui/react';
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { RootState } from 'app/store/store';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions'; import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions';
import SDXLImageToImageTabParameters from 'features/sdxl/components/SDXLImageToImageTabParameters';
import SDXLTextToImageTabParameters from 'features/sdxl/components/SDXLTextToImageTabParameters';
import InvokeAILogoComponent from 'features/system/components/InvokeAILogoComponent'; import InvokeAILogoComponent from 'features/system/components/InvokeAILogoComponent';
import { import {
activeTabNameSelector, activeTabNameSelector,
@ -39,13 +42,23 @@ const ParametersDrawer = () => {
dispatch(setShouldShowParametersPanel(false)); dispatch(setShouldShowParametersPanel(false));
}; };
const model = useAppSelector((state: RootState) => state.generation.model);
const drawerContent = useMemo(() => { const drawerContent = useMemo(() => {
if (activeTabName === 'txt2img') { if (activeTabName === 'txt2img') {
return <TextToImageTabParameters />; return model && model.base_model === 'sdxl' ? (
<SDXLTextToImageTabParameters />
) : (
<TextToImageTabParameters />
);
} }
if (activeTabName === 'img2img') { if (activeTabName === 'img2img') {
return <ImageToImageTabParameters />; return model && model.base_model === 'sdxl' ? (
<SDXLImageToImageTabParameters />
) : (
<ImageToImageTabParameters />
);
} }
if (activeTabName === 'unifiedCanvas') { if (activeTabName === 'unifiedCanvas') {
@ -53,7 +66,7 @@ const ParametersDrawer = () => {
} }
return null; return null;
}, [activeTabName]); }, [activeTabName, model]);
if (shouldPinParametersPanel) { if (shouldPinParametersPanel) {
return null; return null;

View File

@ -1,7 +1,7 @@
import { Flex } from '@chakra-ui/react'; import { Flex } from '@chakra-ui/react';
import { RootState } from 'app/store/store'; import { RootState } from 'app/store/store';
import { useAppSelector } from 'app/store/storeHooks'; import { useAppSelector } from 'app/store/storeHooks';
import TextToImageSDXLTabParameters from 'features/sdxl/components/SDXLTextToImageTabParameters'; import SDXLTextToImageTabParameters from 'features/sdxl/components/SDXLTextToImageTabParameters';
import { memo } from 'react'; import { memo } from 'react';
import ParametersPinnedWrapper from '../../ParametersPinnedWrapper'; import ParametersPinnedWrapper from '../../ParametersPinnedWrapper';
import TextToImageTabMain from './TextToImageTabMain'; import TextToImageTabMain from './TextToImageTabMain';
@ -13,7 +13,7 @@ const TextToImageTab = () => {
<Flex sx={{ gap: 4, w: 'full', h: 'full' }}> <Flex sx={{ gap: 4, w: 'full', h: 'full' }}>
<ParametersPinnedWrapper> <ParametersPinnedWrapper>
{model && model.base_model === 'sdxl' ? ( {model && model.base_model === 'sdxl' ? (
<TextToImageSDXLTabParameters /> <SDXLTextToImageTabParameters />
) : ( ) : (
<TextToImageTabParameters /> <TextToImageTabParameters />
)} )}