mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): add config slice, configuration default values
This commit is contained in:
@ -35,7 +35,10 @@ export const invocationStarted = createAction<
|
||||
>('socket/invocationStarted');
|
||||
|
||||
export const invocationComplete = createAction<
|
||||
BaseSocketPayload & { data: InvocationCompleteEvent }
|
||||
BaseSocketPayload & {
|
||||
data: InvocationCompleteEvent;
|
||||
shouldFetchImages: boolean;
|
||||
}
|
||||
>('socket/invocationComplete');
|
||||
|
||||
export const invocationError = createAction<
|
||||
|
@ -92,9 +92,9 @@ export const socketMiddleware = () => {
|
||||
socket.on('connect', () => {
|
||||
dispatch(socketConnected({ timestamp: getTimestamp() }));
|
||||
|
||||
const { results, uploads, models, nodes, system } = getState();
|
||||
const { results, uploads, models, nodes, config } = getState();
|
||||
|
||||
const { disabledTabs } = system;
|
||||
const { disabledTabs } = config;
|
||||
|
||||
// These thunks need to be dispatch in middleware; cannot handle in a reducer
|
||||
if (!results.ids.length) {
|
||||
@ -203,13 +203,20 @@ export const socketMiddleware = () => {
|
||||
const sessionId = data.graph_execution_state_id;
|
||||
|
||||
const { cancelType, isCancelScheduled } = getState().system;
|
||||
const { shouldFetchImages } = getState().config;
|
||||
|
||||
// Handle scheduled cancelation
|
||||
if (cancelType === 'scheduled' && isCancelScheduled) {
|
||||
dispatch(sessionCanceled({ sessionId }));
|
||||
}
|
||||
|
||||
dispatch(invocationComplete({ data, timestamp: getTimestamp() }));
|
||||
dispatch(
|
||||
invocationComplete({
|
||||
data,
|
||||
timestamp: getTimestamp(),
|
||||
shouldFetchImages,
|
||||
})
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
@ -218,9 +225,9 @@ export const socketMiddleware = () => {
|
||||
}
|
||||
|
||||
if (invocationComplete.match(action)) {
|
||||
const { results } = getState();
|
||||
const { config } = getState();
|
||||
|
||||
if (results.shouldFetchImages) {
|
||||
if (config.shouldFetchImages) {
|
||||
const { result } = action.payload.data;
|
||||
if (isImageOutput(result)) {
|
||||
const imageName = result.image.image_name;
|
||||
|
Reference in New Issue
Block a user