Skip to content

Commit 57d4143

Browse files
authored
Merge branch 'invoke-ai:main' into main
2 parents ff74370 + 23f0c70 commit 57d4143

File tree

3 files changed

+37
-21
lines changed

3 files changed

+37
-21
lines changed

invokeai/app/invocations/latent.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from ...backend.stable_diffusion.diffusion.shared_invokeai_diffusion import \
2323
PostprocessingSettings
2424
from ...backend.stable_diffusion.schedulers import SCHEDULER_MAP
25-
from ...backend.util.devices import torch_dtype
25+
from ...backend.util.devices import choose_torch_device, torch_dtype
2626
from ..models.image import ImageCategory, ImageField, ResourceOrigin
2727
from .baseinvocation import (BaseInvocation, BaseInvocationOutput,
2828
InvocationConfig, InvocationContext)
@@ -38,7 +38,6 @@
3838
XFormersAttnProcessor,
3939
)
4040

41-
4241
class LatentsField(BaseModel):
4342
"""A latents field used for passing latents between invocations"""
4443

invokeai/frontend/web/src/features/nodes/components/ProgressImageNode.tsx

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,46 @@
11
import { Flex, Image } from '@chakra-ui/react';
2-
import { NodeProps } from 'reactflow';
3-
import { InvocationValue } from '../types/types';
4-
5-
import { useAppSelector } from 'app/store/storeHooks';
2+
import { RootState } from 'app/store/store';
63
import { IAINoContentFallback } from 'common/components/IAIImageFallback';
74
import { memo } from 'react';
5+
import { useDispatch, useSelector } from 'react-redux';
6+
import { NodeProps, OnResize } from 'reactflow';
7+
import { setProgressNodeSize } from '../store/nodesSlice';
88
import IAINodeHeader from './IAINode/IAINodeHeader';
99
import IAINodeResizer from './IAINode/IAINodeResizer';
1010
import NodeWrapper from './NodeWrapper';
1111

12-
const ProgressImageNode = (props: NodeProps<InvocationValue>) => {
13-
const progressImage = useAppSelector((state) => state.system.progressImage);
12+
const ProgressImageNode = (props: NodeProps) => {
13+
const progressImage = useSelector(
14+
(state: RootState) => state.system.progressImage
15+
);
16+
const progressNodeSize = useSelector(
17+
(state: RootState) => state.nodes.progressNodeSize
18+
);
19+
const dispatch = useDispatch();
1420
const { selected } = props;
1521

22+
const handleResize: OnResize = (_, newSize) => {
23+
dispatch(setProgressNodeSize(newSize));
24+
};
25+
1626
return (
1727
<NodeWrapper selected={selected}>
1828
<IAINodeHeader
1929
title="Progress Image"
2030
description="Displays the progress image in the Node Editor"
2131
/>
22-
2332
<Flex
24-
className="nopan"
2533
sx={{
2634
flexDirection: 'column',
35+
flexShrink: 0,
2736
borderBottomRadius: 'md',
28-
p: 2,
2937
bg: 'base.200',
3038
_dark: { bg: 'base.800' },
39+
width: progressNodeSize.width - 2,
40+
height: progressNodeSize.height - 2,
41+
minW: 250,
42+
minH: 250,
43+
overflow: 'hidden',
3144
}}
3245
>
3346
{progressImage ? (
@@ -42,22 +55,17 @@ const ProgressImageNode = (props: NodeProps<InvocationValue>) => {
4255
) : (
4356
<Flex
4457
sx={{
45-
w: 'full',
46-
h: 'full',
47-
minW: 32,
48-
minH: 32,
49-
alignItems: 'center',
50-
justifyContent: 'center',
58+
minW: 250,
59+
minH: 250,
60+
width: progressNodeSize.width - 2,
61+
height: progressNodeSize.height - 2,
5162
}}
5263
>
5364
<IAINoContentFallback />
5465
</Flex>
5566
)}
5667
</Flex>
57-
<IAINodeResizer
58-
maxHeight={progressImage?.height ?? 512}
59-
maxWidth={progressImage?.width ?? 512}
60-
/>
68+
<IAINodeResizer onResize={handleResize} />
6169
</NodeWrapper>
6270
);
6371
};

invokeai/frontend/web/src/features/nodes/store/nodesSlice.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export type NodesState = {
3535
shouldShowFieldTypeLegend: boolean;
3636
shouldShowMinimapPanel: boolean;
3737
editorInstance: ReactFlowInstance | undefined;
38+
progressNodeSize: { width: number; height: number };
3839
};
3940

4041
export const initialNodesState: NodesState = {
@@ -47,6 +48,7 @@ export const initialNodesState: NodesState = {
4748
shouldShowFieldTypeLegend: false,
4849
shouldShowMinimapPanel: true,
4950
editorInstance: undefined,
51+
progressNodeSize: { width: 512, height: 512 },
5052
};
5153

5254
const nodesSlice = createSlice({
@@ -157,6 +159,12 @@ const nodesSlice = createSlice({
157159
loadFileEdges: (state, action: PayloadAction<Edge[]>) => {
158160
state.edges = action.payload;
159161
},
162+
setProgressNodeSize: (
163+
state,
164+
action: PayloadAction<{ width: number; height: number }>
165+
) => {
166+
state.progressNodeSize = action.payload;
167+
},
160168
},
161169
extraReducers: (builder) => {
162170
builder.addCase(receivedOpenAPISchema.fulfilled, (state, action) => {
@@ -182,6 +190,7 @@ export const {
182190
setEditorInstance,
183191
loadFileNodes,
184192
loadFileEdges,
193+
setProgressNodeSize,
185194
} = nodesSlice.actions;
186195

187196
export default nodesSlice.reducer;

0 commit comments

Comments
 (0)