mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
more use parameter fixes
This commit is contained in:
parent
1e94d7739a
commit
a4c44edf8d
@ -251,7 +251,8 @@ const HoverableImage = memo((props: HoverableImageProps) => {
|
||||
icon={<IoArrowUndoCircleOutline />}
|
||||
onClickCapture={handleUseAllParameters}
|
||||
isDisabled={
|
||||
!['txt2img', 'img2img', 'inpaint'].includes(
|
||||
// what should these be
|
||||
!['t2l', 'l2l', 'inpaint'].includes(
|
||||
String(image?.metadata?.type)
|
||||
)
|
||||
}
|
||||
|
@ -12,11 +12,9 @@ const useSetBothPrompts = () => {
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
return useCallback(
|
||||
(inputPrompt: InvokeAI.Prompt, negativePrompt?: InvokeAI.Prompt) => {
|
||||
(inputPrompt: InvokeAI.Prompt, negativePrompt: InvokeAI.Prompt) => {
|
||||
dispatch(setPositivePrompt(inputPrompt));
|
||||
if (negativePrompt) {
|
||||
dispatch(setNegativePrompt(negativePrompt));
|
||||
}
|
||||
dispatch(setNegativePrompt(negativePrompt));
|
||||
},
|
||||
[dispatch]
|
||||
);
|
||||
|
@ -7,19 +7,29 @@ export const setAllParametersReducer = (
|
||||
state: Draft<GenerationState>,
|
||||
action: PayloadAction<ImageDTO | undefined>
|
||||
) => {
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user