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

View File

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

View File

@ -1,5 +1,5 @@
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
@ -25,10 +25,8 @@ export type ModelLoadStartedEvent = {
queue_item_id: number;
queue_batch_id: string;
graph_execution_state_id: string;
model_name: string;
base_model: BaseModelType;
model_type: ModelType;
submodel: SubModelType;
model_config: AnyModelConfig;
submodel_type?: SubModelType | null;
};
export type ModelLoadCompletedEvent = {
@ -36,13 +34,8 @@ export type ModelLoadCompletedEvent = {
queue_item_id: number;
queue_batch_id: string;
graph_execution_state_id: string;
model_name: string;
base_model: BaseModelType;
model_type: ModelType;
submodel: SubModelType;
hash?: string;
location: string;
precision: string;
model_config: AnyModelConfig;
submodel_type?: SubModelType | null;
};
export type ModelInstallDownloadingEvent = {