diff --git a/invokeai/app/invocations/generate.py b/invokeai/app/invocations/generate.py index aa16243093..6af959a5bd 100644 --- a/invokeai/app/invocations/generate.py +++ b/invokeai/app/invocations/generate.py @@ -56,7 +56,7 @@ class TextToImageInvocation(BaseInvocation, SDImageInvocation): width: int = Field(default=512, multiple_of=8, gt=0, description="The width of the resulting image", ) height: int = Field(default=512, multiple_of=8, gt=0, description="The height of the resulting image", ) cfg_scale: float = Field(default=7.5, ge=1, description="The Classifier-Free Guidance, higher values may result in a result closer to the prompt", ) - scheduler: SAMPLER_NAME_VALUES = Field(default="lms", description="The scheduler to use" ) + scheduler: SAMPLER_NAME_VALUES = Field(default="euler", description="The scheduler to use" ) model: str = Field(default="", description="The model to use (currently ignored)") # fmt: on diff --git a/invokeai/app/invocations/latent.py b/invokeai/app/invocations/latent.py index 34da76d39a..12cebdf41d 100644 --- a/invokeai/app/invocations/latent.py +++ b/invokeai/app/invocations/latent.py @@ -167,7 +167,7 @@ class TextToLatentsInvocation(BaseInvocation): noise: Optional[LatentsField] = Field(description="The noise to use") steps: int = Field(default=10, gt=0, description="The number of steps to use to generate the image") cfg_scale: float = Field(default=7.5, gt=0, description="The Classifier-Free Guidance, higher values may result in a result closer to the prompt", ) - scheduler: SAMPLER_NAME_VALUES = Field(default="lms", description="The scheduler to use" ) + scheduler: SAMPLER_NAME_VALUES = Field(default="euler", description="The scheduler to use" ) model: str = Field(default="", description="The model to use (currently ignored)") # seamless: bool = Field(default=False, description="Whether or not to generate an image that can tile without seams", ) # seamless_axes: str = Field(default="", description="The axes to tile the image on, 'x' and/or 'y'") diff --git a/invokeai/frontend/web/src/features/gallery/components/CurrentImageButtons.tsx b/invokeai/frontend/web/src/features/gallery/components/CurrentImageButtons.tsx index f5265b54db..c19a404a37 100644 --- a/invokeai/frontend/web/src/features/gallery/components/CurrentImageButtons.tsx +++ b/invokeai/frontend/web/src/features/gallery/components/CurrentImageButtons.tsx @@ -109,8 +109,9 @@ const currentImageButtonsSelector = createSelector( isLightboxOpen, shouldHidePreview, image: selectedImage, - seed: selectedImage?.metadata?.invokeai?.node?.seed, - prompt: selectedImage?.metadata?.invokeai?.node?.prompt, + seed: selectedImage?.metadata?.seed, + prompt: selectedImage?.metadata?.positive_conditioning, + negativePrompt: selectedImage?.metadata?.negative_conditioning, }; }, { @@ -245,13 +246,16 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => { ); const handleUseSeed = useCallback(() => { - recallSeed(image?.metadata?.invokeai?.node?.seed); + recallSeed(image?.metadata?.seed); }, [image, recallSeed]); useHotkeys('s', handleUseSeed, [image]); const handleUsePrompt = useCallback(() => { - recallPrompt(image?.metadata?.invokeai?.node?.prompt); + recallPrompt( + image?.metadata?.positive_conditioning, + image?.metadata?.negative_conditioning + ); }, [image, recallPrompt]); useHotkeys('p', handleUsePrompt, [image]); @@ -454,7 +458,7 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => { {t('parameters.copyImageToLink')} - + } size="sm" w="100%"> {t('parameters.downloadImage')} @@ -500,7 +504,7 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => { icon={} tooltip={`${t('parameters.usePrompt')} (P)`} aria-label={`${t('parameters.usePrompt')} (P)`} - isDisabled={!image?.metadata?.invokeai?.node?.prompt} + isDisabled={!image?.metadata?.positive_conditioning} onClick={handleUsePrompt} /> @@ -508,7 +512,7 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => { icon={} tooltip={`${t('parameters.useSeed')} (S)`} aria-label={`${t('parameters.useSeed')} (S)`} - isDisabled={!image?.metadata?.invokeai?.node?.seed} + isDisabled={!image?.metadata?.seed} onClick={handleUseSeed} /> @@ -517,9 +521,8 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => { tooltip={`${t('parameters.useAll')} (A)`} aria-label={`${t('parameters.useAll')} (A)`} isDisabled={ - !['txt2img', 'img2img', 'inpaint'].includes( - String(image?.metadata?.invokeai?.node?.type) - ) + // not sure what this list should be + !['t2l', 'l2l', 'inpaint'].includes(String(image?.metadata?.type)) } onClick={handleClickUseAllParameters} /> diff --git a/invokeai/frontend/web/src/features/gallery/components/HoverableImage.tsx b/invokeai/frontend/web/src/features/gallery/components/HoverableImage.tsx index 04fecac463..ed427f4984 100644 --- a/invokeai/frontend/web/src/features/gallery/components/HoverableImage.tsx +++ b/invokeai/frontend/web/src/features/gallery/components/HoverableImage.tsx @@ -155,7 +155,10 @@ const HoverableImage = memo((props: HoverableImageProps) => { // Recall parameters handlers const handleRecallPrompt = useCallback(() => { - recallPrompt(image.metadata?.positive_conditioning); + recallPrompt( + image.metadata?.positive_conditioning, + image.metadata?.negative_conditioning + ); }, [image, recallPrompt]); const handleRecallSeed = useCallback(() => { @@ -248,7 +251,8 @@ const HoverableImage = memo((props: HoverableImageProps) => { icon={} onClickCapture={handleUseAllParameters} isDisabled={ - !['txt2img', 'img2img', 'inpaint'].includes( + // what should these be + !['t2l', 'l2l', 'inpaint'].includes( String(image?.metadata?.type) ) } diff --git a/invokeai/frontend/web/src/features/gallery/components/ImageMetaDataViewer/ImageMetadataViewer.tsx b/invokeai/frontend/web/src/features/gallery/components/ImageMetaDataViewer/ImageMetadataViewer.tsx index b4bf9a6d25..b01191105e 100644 --- a/invokeai/frontend/web/src/features/gallery/components/ImageMetaDataViewer/ImageMetadataViewer.tsx +++ b/invokeai/frontend/web/src/features/gallery/components/ImageMetaDataViewer/ImageMetadataViewer.tsx @@ -8,29 +8,20 @@ import { Text, Tooltip, } from '@chakra-ui/react'; -import * as InvokeAI from 'app/types/invokeai'; import { useAppDispatch } from 'app/store/storeHooks'; import { useGetUrl } from 'common/util/getUrl'; import promptToString from 'common/util/promptToString'; -import { seedWeightsToString } from 'common/util/seedWeightPairs'; -import useSetBothPrompts from 'features/parameters/hooks/usePrompt'; import { setCfgScale, setHeight, setImg2imgStrength, setNegativePrompt, - setPerlin, setPositivePrompt, setScheduler, - setSeamless, setSeed, - setSeedWeights, - setShouldFitToWidthHeight, setSteps, - setThreshold, setWidth, } from 'features/parameters/store/generationSlice'; -import { setHiresFix } from 'features/parameters/store/postprocessingSlice'; import { setShouldShowImageDetails } from 'features/ui/store/uiSlice'; import { memo } from 'react'; import { useHotkeys } from 'react-hotkeys-hook'; @@ -39,7 +30,6 @@ import { FaCopy } from 'react-icons/fa'; import { IoArrowUndoCircleOutline } from 'react-icons/io5'; import { OverlayScrollbarsComponent } from 'overlayscrollbars-react'; import { ImageDTO } from 'services/api'; -import { filter } from 'lodash-es'; import { Scheduler } from 'app/constants'; type MetadataItemProps = { @@ -126,8 +116,6 @@ const memoEqualityCheck = ( const ImageMetadataViewer = memo(({ image }: ImageMetadataViewerProps) => { const dispatch = useAppDispatch(); - const setBothPrompts = useSetBothPrompts(); - useHotkeys('esc', () => { dispatch(setShouldShowImageDetails(false)); }); diff --git a/invokeai/frontend/web/src/features/gallery/components/NextPrevImageButtons.tsx b/invokeai/frontend/web/src/features/gallery/components/NextPrevImageButtons.tsx index d0d25f8bc6..fcf8359187 100644 --- a/invokeai/frontend/web/src/features/gallery/components/NextPrevImageButtons.tsx +++ b/invokeai/frontend/web/src/features/gallery/components/NextPrevImageButtons.tsx @@ -33,7 +33,7 @@ export const nextPrevImageButtonsSelector = createSelector( } const currentImageIndex = state[currentCategory].ids.findIndex( - (i) => i === selectedImage.name + (i) => i === selectedImage.image_name ); const nextImageIndex = clamp( diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildTextToImageGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildTextToImageGraph.ts index cbe16abe28..51f89e8f74 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildTextToImageGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildTextToImageGraph.ts @@ -11,7 +11,7 @@ import { addNoiseNodes } from '../nodeBuilders/addNoiseNodes'; const POSITIVE_CONDITIONING = 'positive_conditioning'; const NEGATIVE_CONDITIONING = 'negative_conditioning'; const TEXT_TO_LATENTS = 'text_to_latents'; -const LATENTS_TO_IMAGE = 'latnets_to_image'; +const LATENTS_TO_IMAGE = 'latents_to_image'; /** * Builds the Text to Image tab graph. diff --git a/invokeai/frontend/web/src/features/parameters/hooks/useParameters.ts b/invokeai/frontend/web/src/features/parameters/hooks/useParameters.ts index ad9985b5de..27ae63e5dd 100644 --- a/invokeai/frontend/web/src/features/parameters/hooks/useParameters.ts +++ b/invokeai/frontend/web/src/features/parameters/hooks/useParameters.ts @@ -21,8 +21,8 @@ export const useParameters = () => { * Sets prompt with toast */ const recallPrompt = useCallback( - (prompt: unknown) => { - if (!isString(prompt)) { + (prompt: unknown, negativePrompt?: unknown) => { + if (!isString(prompt) || !isString(negativePrompt)) { toaster({ title: t('toast.promptNotSet'), description: t('toast.promptNotSetDesc'), @@ -33,7 +33,7 @@ export const useParameters = () => { return; } - setBothPrompts(prompt); + setBothPrompts(prompt, negativePrompt); toaster({ title: t('toast.promptSet'), status: 'info', @@ -112,12 +112,13 @@ export const useParameters = () => { const recallAllParameters = useCallback( (image: ImageDTO | undefined) => { const type = image?.metadata?.type; - if (['txt2img', 'img2img', 'inpaint'].includes(String(type))) { + // not sure what this list should be + if (['t2l', 'l2l', 'inpaint'].includes(String(type))) { dispatch(allParametersSet(image)); - if (image?.metadata?.type === 'img2img') { + if (image?.metadata?.type === 'l2l') { dispatch(setActiveTab('img2img')); - } else if (image?.metadata?.type === 'txt2img') { + } else if (image?.metadata?.type === 't2l') { dispatch(setActiveTab('txt2img')); } diff --git a/invokeai/frontend/web/src/features/parameters/hooks/usePrompt.ts b/invokeai/frontend/web/src/features/parameters/hooks/usePrompt.ts index 2a6a832720..3fee0bcdd8 100644 --- a/invokeai/frontend/web/src/features/parameters/hooks/usePrompt.ts +++ b/invokeai/frontend/web/src/features/parameters/hooks/usePrompt.ts @@ -12,15 +12,8 @@ const useSetBothPrompts = () => { const dispatch = useAppDispatch(); return useCallback( - (inputPrompt: InvokeAI.Prompt) => { - const promptString = - typeof inputPrompt === 'string' - ? inputPrompt - : promptToString(inputPrompt); - - const [prompt, negativePrompt] = getPromptAndNegative(promptString); - - dispatch(setPositivePrompt(prompt)); + (inputPrompt: InvokeAI.Prompt, negativePrompt: InvokeAI.Prompt) => { + dispatch(setPositivePrompt(inputPrompt)); dispatch(setNegativePrompt(negativePrompt)); }, [dispatch] diff --git a/invokeai/frontend/web/src/features/parameters/store/generationSlice.ts b/invokeai/frontend/web/src/features/parameters/store/generationSlice.ts index f5054f1969..849f848ff3 100644 --- a/invokeai/frontend/web/src/features/parameters/store/generationSlice.ts +++ b/invokeai/frontend/web/src/features/parameters/store/generationSlice.ts @@ -52,7 +52,7 @@ export const initialGenerationState: GenerationState = { perlin: 0, positivePrompt: '', negativePrompt: '', - scheduler: 'lms', + scheduler: 'euler', seamBlur: 16, seamSize: 96, seamSteps: 30, diff --git a/invokeai/frontend/web/src/features/parameters/store/setAllParametersReducer.ts b/invokeai/frontend/web/src/features/parameters/store/setAllParametersReducer.ts index d6d1af0f8e..8f06c7d0ef 100644 --- a/invokeai/frontend/web/src/features/parameters/store/setAllParametersReducer.ts +++ b/invokeai/frontend/web/src/features/parameters/store/setAllParametersReducer.ts @@ -7,19 +7,29 @@ export const setAllParametersReducer = ( state: Draft, action: PayloadAction ) => { - const node = action.payload?.metadata.invokeai?.node; + const metadata = action.payload?.metadata; - if (!node) { + if (!metadata) { return; } + // not sure what this list should be if ( - node.type === 'txt2img' || - node.type === 'img2img' || - node.type === 'inpaint' + metadata.type === 't2l' || + metadata.type === 'l2l' || + metadata.type === 'inpaint' ) { - const { cfg_scale, height, model, prompt, scheduler, seed, steps, width } = - node; + const { + cfg_scale, + height, + model, + positive_conditioning, + negative_conditioning, + scheduler, + seed, + steps, + width, + } = metadata; if (cfg_scale !== undefined) { state.cfgScale = Number(cfg_scale); @@ -30,8 +40,11 @@ export const setAllParametersReducer = ( if (model !== undefined) { state.model = String(model); } - if (prompt !== undefined) { - state.positivePrompt = String(prompt); + if (positive_conditioning !== undefined) { + state.positivePrompt = String(positive_conditioning); + } + if (negative_conditioning !== undefined) { + state.negativePrompt = String(negative_conditioning); } if (scheduler !== undefined) { const schedulerString = String(scheduler); @@ -51,8 +64,8 @@ export const setAllParametersReducer = ( } } - if (node.type === 'img2img') { - const { fit, image } = node as ImageToImageInvocation; + if (metadata.type === 'l2l') { + const { fit, image } = metadata as ImageToImageInvocation; if (fit !== undefined) { state.shouldFitToWidthHeight = Boolean(fit);