mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-04 20:00:00 +08:00
refactor: Improve provider removal logic in LLM store
This commit is contained in:
parent
382b4570cf
commit
6e889f4cca
@ -461,7 +461,10 @@ const settingsSlice = createSlice({
|
|||||||
state.providers.unshift(action.payload)
|
state.providers.unshift(action.payload)
|
||||||
},
|
},
|
||||||
removeProvider: (state, action: PayloadAction<Provider>) => {
|
removeProvider: (state, action: PayloadAction<Provider>) => {
|
||||||
state.providers = state.providers.filter((p) => p.id !== action.payload.id)
|
const providerIndex = state.providers.findIndex((p) => p.id === action.payload.id)
|
||||||
|
if (providerIndex !== -1) {
|
||||||
|
state.providers.splice(providerIndex, 1)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
addModel: (state, action: PayloadAction<{ providerId: string; model: Model }>) => {
|
addModel: (state, action: PayloadAction<{ providerId: string; model: Model }>) => {
|
||||||
state.providers = state.providers.map((p) =>
|
state.providers = state.providers.map((p) =>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user