fix(ui): log model load events

- Fix types
- Fix logging in listener
This commit is contained in:
psychedelicious 2024-03-14 17:39:23 +11:00 committed by blessedcoolant
parent ef55077e84
commit 328dc99f3a
2 changed files with 19 additions and 22 deletions
invokeai/frontend/web/src
app/store/middleware/listenerMiddleware/listeners/socketio
services/events

View File

@ -8,14 +8,16 @@ export const addModelLoadEventListener = (startAppListening: AppStartListening)
startAppListening({ startAppListening({
actionCreator: socketModelLoadStarted, actionCreator: socketModelLoadStarted,
effect: (action) => { effect: (action) => {
const { base_model, model_name, model_type, submodel } = action.payload.data; const { model_config, submodel_type } = action.payload.data;
const { name, base, type } = model_config;
let message = `Model load started: ${base_model}/${model_type}/${model_name}`; const extras: string[] = [base, type];
if (submodel_type) {
if (submodel) { extras.push(submodel_type);
message = message.concat(`/${submodel}`);
} }
const message = `Model load started: ${name} (${extras.join(', ')})`;
log.debug(action.payload, message); log.debug(action.payload, message);
}, },
}); });
@ -23,14 +25,16 @@ export const addModelLoadEventListener = (startAppListening: AppStartListening)
startAppListening({ startAppListening({
actionCreator: socketModelLoadCompleted, actionCreator: socketModelLoadCompleted,
effect: (action) => { effect: (action) => {
const { base_model, model_name, model_type, submodel } = action.payload.data; const { model_config, submodel_type } = action.payload.data;
const { name, base, type } = model_config;
let message = `Model load complete: ${base_model}/${model_type}/${model_name}`; const extras: string[] = [base, type];
if (submodel_type) {
if (submodel) { extras.push(submodel_type);
message = message.concat(`/${submodel}`);
} }
const message = `Model load complete: ${name} (${extras.join(', ')})`;
log.debug(action.payload, message); log.debug(action.payload, message);
}, },
}); });

View File

@ -1,5 +1,5 @@
import type { components } from 'services/api/schema'; import type { components } from 'services/api/schema';
import type { BaseModelType, Graph, GraphExecutionState, ModelType, SubModelType } from 'services/api/types'; import type { AnyModelConfig, Graph, GraphExecutionState, SubModelType } from 'services/api/types';
/** /**
* A progress image, we get one for each step in the generation * A progress image, we get one for each step in the generation
@ -25,10 +25,8 @@ export type ModelLoadStartedEvent = {
queue_item_id: number; queue_item_id: number;
queue_batch_id: string; queue_batch_id: string;
graph_execution_state_id: string; graph_execution_state_id: string;
model_name: string; model_config: AnyModelConfig;
base_model: BaseModelType; submodel_type?: SubModelType | null;
model_type: ModelType;
submodel: SubModelType;
}; };
export type ModelLoadCompletedEvent = { export type ModelLoadCompletedEvent = {
@ -36,13 +34,8 @@ export type ModelLoadCompletedEvent = {
queue_item_id: number; queue_item_id: number;
queue_batch_id: string; queue_batch_id: string;
graph_execution_state_id: string; graph_execution_state_id: string;
model_name: string; model_config: AnyModelConfig;
base_model: BaseModelType; submodel_type?: SubModelType | null;
model_type: ModelType;
submodel: SubModelType;
hash?: string;
location: string;
precision: string;
}; };
export type ModelInstallDownloadingEvent = { export type ModelInstallDownloadingEvent = {