mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): add warning socket event handling
This commit is contained in:
@ -5,6 +5,7 @@ import {
|
||||
InvocationCompleteEvent,
|
||||
InvocationErrorEvent,
|
||||
InvocationStartedEvent,
|
||||
InvocationWarningEvent,
|
||||
} from 'services/events/types';
|
||||
|
||||
// Common socket action payload data
|
||||
@ -131,6 +132,24 @@ export const appSocketInvocationError = createAction<
|
||||
BaseSocketPayload & { data: InvocationErrorEvent }
|
||||
>('socket/appSocketInvocationError');
|
||||
|
||||
/**
|
||||
* Socket.IO Invocation Warning
|
||||
*
|
||||
* Do not use. Only for use in middleware.
|
||||
*/
|
||||
export const socketInvocationWarning = createAction<
|
||||
BaseSocketPayload & { data: InvocationWarningEvent }
|
||||
>('socket/socketInvocationWarning');
|
||||
|
||||
/**
|
||||
* Socket.IO Invocation Warning
|
||||
*
|
||||
* Do not use. Only for use in middleware.
|
||||
*/
|
||||
export const appSocketInvocationWarning = createAction<
|
||||
BaseSocketPayload & { data: InvocationWarningEvent }
|
||||
>('socket/appSocketInvocationWarning');
|
||||
|
||||
/**
|
||||
* Socket.IO Graph Execution State Complete
|
||||
*
|
||||
|
@ -63,6 +63,18 @@ export type InvocationErrorEvent = {
|
||||
error: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* A `invocation_warning` socket.io event.
|
||||
*
|
||||
* @example socket.on('invocation_warning', (data: InvocationWarningEvent) => { ... }
|
||||
*/
|
||||
export type InvocationWarningEvent = {
|
||||
graph_execution_state_id: string;
|
||||
node: BaseNode;
|
||||
source_node_id: string;
|
||||
warning: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* A `invocation_started` socket.io event.
|
||||
*
|
||||
@ -95,6 +107,7 @@ export type ServerToClientEvents = {
|
||||
generator_progress: (payload: GeneratorProgressEvent) => void;
|
||||
invocation_complete: (payload: InvocationCompleteEvent) => void;
|
||||
invocation_error: (payload: InvocationErrorEvent) => void;
|
||||
invocation_warning: (payload: InvocationWarningEvent) => void;
|
||||
invocation_started: (payload: InvocationStartedEvent) => void;
|
||||
graph_execution_state_complete: (
|
||||
payload: GraphExecutionStateCompleteEvent
|
||||
|
@ -11,6 +11,7 @@ import {
|
||||
socketConnected,
|
||||
socketDisconnected,
|
||||
socketSubscribed,
|
||||
socketInvocationWarning,
|
||||
} from '../actions';
|
||||
import { ClientToServerEvents, ServerToClientEvents } from '../types';
|
||||
import { Logger } from 'roarr';
|
||||
@ -94,6 +95,13 @@ export const setEventListeners = (arg: SetEventListenersArg) => {
|
||||
dispatch(socketInvocationError({ data, timestamp: getTimestamp() }));
|
||||
});
|
||||
|
||||
/**
|
||||
* Invocation warning
|
||||
*/
|
||||
socket.on('invocation_warning', (data) => {
|
||||
dispatch(socketInvocationWarning({ data, timestamp: getTimestamp() }));
|
||||
});
|
||||
|
||||
/**
|
||||
* Invocation complete
|
||||
*/
|
||||
|
Reference in New Issue
Block a user