fix(ui): fix lora name disappearing (#3753)

This commit is contained in:
blessedcoolant 2023-07-13 22:15:25 +12:00 committed by GitHub
commit af3b7e73ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 10 deletions

View File

@ -37,7 +37,7 @@ const ParamLora = (props: Props) => {
return ( return (
<Flex sx={{ gap: 2.5, alignItems: 'flex-end' }}> <Flex sx={{ gap: 2.5, alignItems: 'flex-end' }}>
<IAISlider <IAISlider
label={lora.name} label={lora.model_name}
value={lora.weight} value={lora.weight}
onChange={handleChange} onChange={handleChange}
min={-1} min={-1}

View File

@ -18,7 +18,7 @@ const selector = createSelector(
const ParamLoraList = () => { const ParamLoraList = () => {
const { loras } = useAppSelector(selector); const { loras } = useAppSelector(selector);
return map(loras, (lora) => <ParamLora key={lora.name} lora={lora} />); return map(loras, (lora) => <ParamLora key={lora.model_name} lora={lora} />);
}; };
export default ParamLoraList; export default ParamLoraList;

View File

@ -1,12 +1,8 @@
import { PayloadAction, createSlice } from '@reduxjs/toolkit'; import { PayloadAction, createSlice } from '@reduxjs/toolkit';
import { LoRAModelParam } from 'features/parameters/store/parameterZodSchemas'; import { LoRAModelParam } from 'features/parameters/store/parameterZodSchemas';
import { LoRAModelConfigEntity } from 'services/api/endpoints/models'; import { LoRAModelConfigEntity } from 'services/api/endpoints/models';
import { BaseModelType } from 'services/api/types';
export type Lora = { export type Lora = LoRAModelParam & {
id: string;
base_model: BaseModelType;
name: string;
weight: number; weight: number;
}; };
@ -27,8 +23,8 @@ export const loraSlice = createSlice({
initialState: intialLoraState, initialState: intialLoraState,
reducers: { reducers: {
loraAdded: (state, action: PayloadAction<LoRAModelConfigEntity>) => { loraAdded: (state, action: PayloadAction<LoRAModelConfigEntity>) => {
const { name, id, base_model } = action.payload; const { model_name, id, base_model } = action.payload;
state.loras[id] = { id, name, base_model, ...defaultLoRAConfig }; state.loras[id] = { id, model_name, base_model, ...defaultLoRAConfig };
}, },
loraRemoved: (state, action: PayloadAction<string>) => { loraRemoved: (state, action: PayloadAction<string>) => {
const id = action.payload; const id = action.payload;

View File

@ -170,7 +170,7 @@ export const isValidVaeModel = (val: unknown): val is VaeModelParam =>
*/ */
export const zLoRAModel = z.object({ export const zLoRAModel = z.object({
id: z.string(), id: z.string(),
name: z.string(), model_name: z.string(),
base_model: zBaseModel, base_model: zBaseModel,
}); });
/** /**