From 23d2af52df052b13ccaa07b9efaf837a97599720 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu, 13 Jul 2023 20:14:26 +1000 Subject: [PATCH] fix(ui): fix lora name disappearing --- .../web/src/features/lora/components/ParamLora.tsx | 2 +- .../web/src/features/lora/components/ParamLoraList.tsx | 2 +- .../frontend/web/src/features/lora/store/loraSlice.ts | 10 +++------- .../features/parameters/store/parameterZodSchemas.ts | 2 +- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/invokeai/frontend/web/src/features/lora/components/ParamLora.tsx b/invokeai/frontend/web/src/features/lora/components/ParamLora.tsx index 4ca9700a8c..7dba2aa6ed 100644 --- a/invokeai/frontend/web/src/features/lora/components/ParamLora.tsx +++ b/invokeai/frontend/web/src/features/lora/components/ParamLora.tsx @@ -37,7 +37,7 @@ const ParamLora = (props: Props) => { return ( { const { loras } = useAppSelector(selector); - return map(loras, (lora) => ); + return map(loras, (lora) => ); }; export default ParamLoraList; diff --git a/invokeai/frontend/web/src/features/lora/store/loraSlice.ts b/invokeai/frontend/web/src/features/lora/store/loraSlice.ts index 6fe6109c4d..a97a0887a5 100644 --- a/invokeai/frontend/web/src/features/lora/store/loraSlice.ts +++ b/invokeai/frontend/web/src/features/lora/store/loraSlice.ts @@ -1,12 +1,8 @@ import { PayloadAction, createSlice } from '@reduxjs/toolkit'; import { LoRAModelParam } from 'features/parameters/store/parameterZodSchemas'; import { LoRAModelConfigEntity } from 'services/api/endpoints/models'; -import { BaseModelType } from 'services/api/types'; -export type Lora = { - id: string; - base_model: BaseModelType; - name: string; +export type Lora = LoRAModelParam & { weight: number; }; @@ -27,8 +23,8 @@ export const loraSlice = createSlice({ initialState: intialLoraState, reducers: { loraAdded: (state, action: PayloadAction) => { - const { name, id, base_model } = action.payload; - state.loras[id] = { id, name, base_model, ...defaultLoRAConfig }; + const { model_name, id, base_model } = action.payload; + state.loras[id] = { id, model_name, base_model, ...defaultLoRAConfig }; }, loraRemoved: (state, action: PayloadAction) => { const id = action.payload; diff --git a/invokeai/frontend/web/src/features/parameters/store/parameterZodSchemas.ts b/invokeai/frontend/web/src/features/parameters/store/parameterZodSchemas.ts index baf560eaff..16fbf0e155 100644 --- a/invokeai/frontend/web/src/features/parameters/store/parameterZodSchemas.ts +++ b/invokeai/frontend/web/src/features/parameters/store/parameterZodSchemas.ts @@ -170,7 +170,7 @@ export const isValidVaeModel = (val: unknown): val is VaeModelParam => */ export const zLoRAModel = z.object({ id: z.string(), - name: z.string(), + model_name: z.string(), base_model: zBaseModel, }); /**