feat(ui): update client for removal of session events

This commit is contained in:
psychedelicious 2024-05-26 11:41:08 +10:00
parent 3d8774d295
commit 60784a4361
7 changed files with 1 additions and 76 deletions

View File

@ -45,7 +45,6 @@ import { addInvocationStartedEventListener } from 'app/store/middleware/listener
import { addModelInstallEventListener } from 'app/store/middleware/listenerMiddleware/listeners/socketio/socketModelInstall'; import { addModelInstallEventListener } from 'app/store/middleware/listenerMiddleware/listeners/socketio/socketModelInstall';
import { addModelLoadEventListener } from 'app/store/middleware/listenerMiddleware/listeners/socketio/socketModelLoad'; import { addModelLoadEventListener } from 'app/store/middleware/listenerMiddleware/listeners/socketio/socketModelLoad';
import { addSocketQueueItemStatusChangedEventListener } from 'app/store/middleware/listenerMiddleware/listeners/socketio/socketQueueItemStatusChanged'; import { addSocketQueueItemStatusChangedEventListener } from 'app/store/middleware/listenerMiddleware/listeners/socketio/socketQueueItemStatusChanged';
import { addSessionEventListeners } from 'app/store/middleware/listenerMiddleware/listeners/socketio/socketSessionEvents';
import { addStagingAreaImageSavedListener } from 'app/store/middleware/listenerMiddleware/listeners/stagingAreaImageSaved'; import { addStagingAreaImageSavedListener } from 'app/store/middleware/listenerMiddleware/listeners/stagingAreaImageSaved';
import { addUpdateAllNodesRequestedListener } from 'app/store/middleware/listenerMiddleware/listeners/updateAllNodesRequested'; import { addUpdateAllNodesRequestedListener } from 'app/store/middleware/listenerMiddleware/listeners/updateAllNodesRequested';
import { addUpscaleRequestedListener } from 'app/store/middleware/listenerMiddleware/listeners/upscaleRequested'; import { addUpscaleRequestedListener } from 'app/store/middleware/listenerMiddleware/listeners/upscaleRequested';
@ -99,7 +98,6 @@ addCommitStagingAreaImageListener(startAppListening);
// Socket.IO // Socket.IO
addGeneratorProgressEventListener(startAppListening); addGeneratorProgressEventListener(startAppListening);
addSessionEventListeners(startAppListening);
addInvocationCompleteEventListener(startAppListening); addInvocationCompleteEventListener(startAppListening);
addInvocationErrorEventListener(startAppListening); addInvocationErrorEventListener(startAppListening);
addInvocationStartedEventListener(startAppListening); addInvocationStartedEventListener(startAppListening);

View File

@ -1,26 +0,0 @@
import { logger } from 'app/logging/logger';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { socketSessionCanceled, socketSessionComplete, socketSessionStarted } from 'services/events/actions';
const log = logger('socketio');
export const addSessionEventListeners = (startAppListening: AppStartListening) => {
startAppListening({
actionCreator: socketSessionStarted,
effect: (action) => {
log.debug(action.payload, 'Session started');
},
});
startAppListening({
actionCreator: socketSessionComplete,
effect: (action) => {
log.debug(action.payload, 'Session complete');
},
});
startAppListening({
actionCreator: socketSessionCanceled,
effect: (action) => {
log.debug(action.payload, 'Session canceled');
},
});
};

View File

@ -11,7 +11,6 @@ import {
socketModelLoadComplete, socketModelLoadComplete,
socketModelLoadStarted, socketModelLoadStarted,
socketQueueItemStatusChanged, socketQueueItemStatusChanged,
socketSessionComplete,
} from 'services/events/actions'; } from 'services/events/actions';
import type { Language, SystemState } from './types'; import type { Language, SystemState } from './types';
@ -125,14 +124,6 @@ export const systemSlice = createSlice({
state.status = 'CONNECTED'; state.status = 'CONNECTED';
}); });
/**
* Graph Execution State Complete
*/
builder.addCase(socketSessionComplete, (state) => {
state.denoiseProgress = null;
state.status = 'CONNECTED';
});
builder.addCase(socketModelLoadStarted, (state) => { builder.addCase(socketModelLoadStarted, (state) => {
state.status = 'LOADING_MODEL'; state.status = 'LOADING_MODEL';
}); });

View File

@ -1,6 +1,5 @@
import { Flex, IconButton, Text } from '@invoke-ai/ui-library'; import { Flex, IconButton, Text } from '@invoke-ai/ui-library';
import { t } from 'i18next'; import { t } from 'i18next';
import { upperFirst } from 'lodash-es';
import { useMemo } from 'react'; import { useMemo } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { PiCopyBold } from 'react-icons/pi'; import { PiCopyBold } from 'react-icons/pi';
@ -32,7 +31,7 @@ export default function ErrorToastDescription({ errorType, errorMessage, session
return t(descriptionTKey); return t(descriptionTKey);
} }
if (errorMessage) { if (errorMessage) {
return upperFirst(errorMessage); return `${errorType}: ${errorMessage}`;
} }
}, [errorMessage, errorType, isLocal, t]); }, [errorMessage, errorType, isLocal, t]);
return ( return (

View File

@ -21,9 +21,6 @@ import type {
ModelLoadCompleteEvent, ModelLoadCompleteEvent,
ModelLoadStartedEvent, ModelLoadStartedEvent,
QueueItemStatusChangedEvent, QueueItemStatusChangedEvent,
SessionCanceledEvent,
SessionCompleteEvent,
SessionStartedEvent,
} from 'services/events/types'; } from 'services/events/types';
// Create actions for each socket // Create actions for each socket
@ -45,18 +42,6 @@ export const socketInvocationError = createAction<{
data: InvocationErrorEvent; data: InvocationErrorEvent;
}>('socket/socketInvocationError'); }>('socket/socketInvocationError');
export const socketSessionStarted = createAction<{
data: SessionStartedEvent;
}>('socket/socketSessionStarted');
export const socketSessionComplete = createAction<{
data: SessionCompleteEvent;
}>('socket/socketGraphExecutionStateComplete');
export const socketSessionCanceled = createAction<{
data: SessionCanceledEvent;
}>('socket/socketSessionCanceled');
export const socketGeneratorProgress = createAction<{ export const socketGeneratorProgress = createAction<{
data: InvocationDenoiseProgressEvent; data: InvocationDenoiseProgressEvent;
}>('socket/socketGeneratorProgress'); }>('socket/socketGeneratorProgress');

View File

@ -26,10 +26,6 @@ export type DownloadCompleteEvent = S['DownloadCompleteEvent'];
export type DownloadCancelledEvent = S['DownloadCancelledEvent']; export type DownloadCancelledEvent = S['DownloadCancelledEvent'];
export type DownloadErrorEvent = S['DownloadErrorEvent']; export type DownloadErrorEvent = S['DownloadErrorEvent'];
export type SessionStartedEvent = S['SessionStartedEvent'];
export type SessionCompleteEvent = S['SessionCompleteEvent'];
export type SessionCanceledEvent = S['SessionCanceledEvent'];
export type QueueItemStatusChangedEvent = S['QueueItemStatusChangedEvent']; export type QueueItemStatusChangedEvent = S['QueueItemStatusChangedEvent'];
export type BulkDownloadStartedEvent = S['BulkDownloadStartedEvent']; export type BulkDownloadStartedEvent = S['BulkDownloadStartedEvent'];
@ -50,9 +46,6 @@ export type ServerToClientEvents = {
invocation_complete: (payload: InvocationCompleteEvent) => void; invocation_complete: (payload: InvocationCompleteEvent) => void;
invocation_error: (payload: InvocationErrorEvent) => void; invocation_error: (payload: InvocationErrorEvent) => void;
invocation_started: (payload: InvocationStartedEvent) => void; invocation_started: (payload: InvocationStartedEvent) => void;
session_started: (payload: SessionStartedEvent) => void;
session_complete: (payload: SessionCompleteEvent) => void;
session_canceled: (payload: SessionCanceledEvent) => void;
download_started: (payload: DownloadStartedEvent) => void; download_started: (payload: DownloadStartedEvent) => void;
download_progress: (payload: DownloadProgressEvent) => void; download_progress: (payload: DownloadProgressEvent) => void;
download_complete: (payload: DownloadCompleteEvent) => void; download_complete: (payload: DownloadCompleteEvent) => void;

View File

@ -27,9 +27,6 @@ import {
socketModelLoadComplete, socketModelLoadComplete,
socketModelLoadStarted, socketModelLoadStarted,
socketQueueItemStatusChanged, socketQueueItemStatusChanged,
socketSessionCanceled,
socketSessionComplete,
socketSessionStarted,
} from 'services/events/actions'; } from 'services/events/actions';
import type { ClientToServerEvents, ServerToClientEvents } from 'services/events/types'; import type { ClientToServerEvents, ServerToClientEvents } from 'services/events/types';
import type { Socket } from 'socket.io-client'; import type { Socket } from 'socket.io-client';
@ -88,18 +85,6 @@ export const setEventListeners = (arg: SetEventListenersArg) => {
dispatch(socketInvocationComplete({ data })); dispatch(socketInvocationComplete({ data }));
}); });
socket.on('session_started', (data) => {
dispatch(socketSessionStarted({ data }));
});
socket.on('session_complete', (data) => {
dispatch(socketSessionComplete({ data }));
});
socket.on('session_canceled', (data) => {
dispatch(socketSessionCanceled({ data }));
});
socket.on('model_load_started', (data) => { socket.on('model_load_started', (data) => {
dispatch(socketModelLoadStarted({ data })); dispatch(socketModelLoadStarted({ data }));
}); });