mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-24 10:40:07 +08:00
refactor: Improve provider removal logic in LLM store
This commit is contained in:
parent
2449a22c69
commit
0c97b52c53
@ -461,7 +461,10 @@ const settingsSlice = createSlice({
|
||||
state.providers.unshift(action.payload)
|
||||
},
|
||||
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 }>) => {
|
||||
state.providers = state.providers.map((p) =>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user