mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): add support for shouldFetchImages if UI needs to re-fetch an image URL
This commit is contained in:
committed by
psychedelicious
parent
f0e4a2124a
commit
9f8ff912c4
@ -30,6 +30,8 @@ import {
|
||||
import { OpenAPI } from 'services/api';
|
||||
import { receivedModels } from 'services/thunks/model';
|
||||
import { receivedOpenAPISchema } from 'services/thunks/schema';
|
||||
import { isImageOutput } from 'services/types/guards';
|
||||
import { imageReceived, thumbnailReceived } from 'services/thunks/image';
|
||||
|
||||
export const socketMiddleware = () => {
|
||||
let areListenersSet = false;
|
||||
@ -213,6 +215,21 @@ export const socketMiddleware = () => {
|
||||
dispatch(sessionInvoked({ sessionId }));
|
||||
}
|
||||
|
||||
if (invocationComplete.match(action)) {
|
||||
const { results } = getState();
|
||||
|
||||
if (results.shouldFetchImages) {
|
||||
const { result } = action.payload.data;
|
||||
if (isImageOutput(result)) {
|
||||
const imageName = result.image.image_name;
|
||||
const imageType = result.image.image_type;
|
||||
|
||||
dispatch(imageReceived({ imageName, imageType }));
|
||||
dispatch(thumbnailReceived({ imageName, imageType }));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Always pass the action on so other middleware and reducers can handle it
|
||||
next(action);
|
||||
};
|
||||
|
Reference in New Issue
Block a user