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 { initialControlNetState } from 'features/controlNet/store/controlNetSlice';
|
||||
import { initialGalleryState } from 'features/gallery/store/gallerySlice';
|
||||
import { initialImagesState } from 'features/gallery/store/imagesSlice';
|
||||
import { initialLightboxState } from 'features/lightbox/store/lightboxSlice';
|
||||
@ -28,6 +29,7 @@ const initialStates: {
|
||||
ui: initialUIState,
|
||||
hotkeys: initialHotkeysState,
|
||||
images: initialImagesState,
|
||||
controlNet: initialControlNetState,
|
||||
};
|
||||
|
||||
export const unserialize: UnserializeFunction = (data, key) => {
|
||||
|
@ -72,6 +72,11 @@ export const addControlNetImageProcessedListener = () => {
|
||||
);
|
||||
const processedControlImage = imageMetadataReceivedAction.payload;
|
||||
|
||||
moduleLog.debug(
|
||||
{ data: { arg: action.payload, processedControlImage } },
|
||||
'ControlNet image processed'
|
||||
);
|
||||
|
||||
// Update the processed image in the store
|
||||
dispatch(
|
||||
controlNetProcessedImageChanged({
|
||||
|
@ -8,13 +8,33 @@ import {
|
||||
|
||||
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 = () => {
|
||||
startAppListening({
|
||||
predicate: (action) =>
|
||||
controlNetProcessorParamsChanged.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;
|
||||
|
||||
// Cancel any in-progress instances of this listener
|
||||
cancelActiveListeners();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user