mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): do not autoprocess control if invocation in progress
This commit is contained in:
parent
9cdad95f48
commit
2eb367969c
@ -1,4 +1,5 @@
|
|||||||
import { initialCanvasState } from 'features/canvas/store/canvasSlice';
|
import { initialCanvasState } from 'features/canvas/store/canvasSlice';
|
||||||
|
import { initialControlNetState } from 'features/controlNet/store/controlNetSlice';
|
||||||
import { initialGalleryState } from 'features/gallery/store/gallerySlice';
|
import { initialGalleryState } from 'features/gallery/store/gallerySlice';
|
||||||
import { initialImagesState } from 'features/gallery/store/imagesSlice';
|
import { initialImagesState } from 'features/gallery/store/imagesSlice';
|
||||||
import { initialLightboxState } from 'features/lightbox/store/lightboxSlice';
|
import { initialLightboxState } from 'features/lightbox/store/lightboxSlice';
|
||||||
@ -28,6 +29,7 @@ const initialStates: {
|
|||||||
ui: initialUIState,
|
ui: initialUIState,
|
||||||
hotkeys: initialHotkeysState,
|
hotkeys: initialHotkeysState,
|
||||||
images: initialImagesState,
|
images: initialImagesState,
|
||||||
|
controlNet: initialControlNetState,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const unserialize: UnserializeFunction = (data, key) => {
|
export const unserialize: UnserializeFunction = (data, key) => {
|
||||||
|
@ -72,6 +72,11 @@ export const addControlNetImageProcessedListener = () => {
|
|||||||
);
|
);
|
||||||
const processedControlImage = imageMetadataReceivedAction.payload;
|
const processedControlImage = imageMetadataReceivedAction.payload;
|
||||||
|
|
||||||
|
moduleLog.debug(
|
||||||
|
{ data: { arg: action.payload, processedControlImage } },
|
||||||
|
'ControlNet image processed'
|
||||||
|
);
|
||||||
|
|
||||||
// Update the processed image in the store
|
// Update the processed image in the store
|
||||||
dispatch(
|
dispatch(
|
||||||
controlNetProcessedImageChanged({
|
controlNetProcessedImageChanged({
|
||||||
|
@ -8,13 +8,33 @@ import {
|
|||||||
|
|
||||||
const moduleLog = log.child({ namespace: 'controlNet' });
|
const moduleLog = log.child({ namespace: 'controlNet' });
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listener that automatically processes a ControlNet image when its processor parameters are changed.
|
||||||
|
*
|
||||||
|
* The network request is debounced by 1 second.
|
||||||
|
*/
|
||||||
export const addControlNetProcessorParamsChangedListener = () => {
|
export const addControlNetProcessorParamsChangedListener = () => {
|
||||||
startAppListening({
|
startAppListening({
|
||||||
predicate: (action) =>
|
predicate: (action) =>
|
||||||
controlNetProcessorParamsChanged.match(action) ||
|
controlNetProcessorParamsChanged.match(action) ||
|
||||||
controlNetProcessorTypeChanged.match(action),
|
controlNetProcessorTypeChanged.match(action),
|
||||||
effect: async (action, { dispatch, cancelActiveListeners, delay }) => {
|
effect: async (
|
||||||
|
action,
|
||||||
|
{ dispatch, getState, cancelActiveListeners, delay }
|
||||||
|
) => {
|
||||||
|
const state = getState();
|
||||||
|
if (!state.controlNet.shouldAutoProcess) {
|
||||||
|
// silently skip
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.system.isProcessing) {
|
||||||
|
moduleLog.trace('System busy, skipping ControlNet auto-processing');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const { controlNetId } = action.payload;
|
const { controlNetId } = action.payload;
|
||||||
|
|
||||||
// Cancel any in-progress instances of this listener
|
// Cancel any in-progress instances of this listener
|
||||||
cancelActiveListeners();
|
cancelActiveListeners();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user