mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-07 22:10:21 +08:00
fix(store): prevent mutation of assistant presets by using spread operator
This commit is contained in:
parent
c97ad627d1
commit
f25142e597
@ -60,7 +60,7 @@ const KnowledgeDirectories: FC<KnowledgeContentProps> = ({ selectedBase, progres
|
|||||||
}
|
}
|
||||||
|
|
||||||
const path = await window.api.file.selectFolder()
|
const path = await window.api.file.selectFolder()
|
||||||
logger.info('Selected directory:', path)
|
logger.info('Selected directory:', { path })
|
||||||
path && addDirectory(path)
|
path && addDirectory(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ const assistantsSlice = createSlice({
|
|||||||
initialState,
|
initialState,
|
||||||
reducers: {
|
reducers: {
|
||||||
setAssistantPresets: (state, action: PayloadAction<AssistantPreset[]>) => {
|
setAssistantPresets: (state, action: PayloadAction<AssistantPreset[]>) => {
|
||||||
state.agents = action.payload
|
state.agents = { ...action.payload }
|
||||||
},
|
},
|
||||||
addAssistantPreset: (state, action: PayloadAction<AssistantPreset>) => {
|
addAssistantPreset: (state, action: PayloadAction<AssistantPreset>) => {
|
||||||
state.agents.push(action.payload)
|
state.agents.push(action.payload)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user