chore: extract the adapter info initial state

This commit is contained in:
blessedcoolant 2023-09-16 16:08:04 +12:00 committed by Kent Keirsey
parent 820ec08e9a
commit 3e813ead1f

View File

@ -74,16 +74,18 @@ export type ControlNetState = {
ipAdapterInfo: IPAdapterConfig; ipAdapterInfo: IPAdapterConfig;
}; };
export const initialIPAdapterState: IPAdapterConfig = {
adapterImage: null,
model: null,
weight: 1,
};
export const initialControlNetState: ControlNetState = { export const initialControlNetState: ControlNetState = {
controlNets: {}, controlNets: {},
isEnabled: false, isEnabled: false,
pendingControlImages: [], pendingControlImages: [],
isIPAdapterEnabled: false, isIPAdapterEnabled: false,
ipAdapterInfo: { ipAdapterInfo: { ...initialIPAdapterState },
adapterImage: null,
model: null,
weight: 1,
},
}; };
export const controlNetSlice = createSlice({ export const controlNetSlice = createSlice({
@ -388,11 +390,7 @@ export const controlNetSlice = createSlice({
}, },
ipAdapterStateReset: (state) => { ipAdapterStateReset: (state) => {
state.isIPAdapterEnabled = false; state.isIPAdapterEnabled = false;
state.ipAdapterInfo = { state.ipAdapterInfo = { ...initialIPAdapterState };
adapterImage: null,
model: null,
weight: 1,
};
}, },
}, },
extraReducers: (builder) => { extraReducers: (builder) => {