Skip to content

Commit

Permalink
🐛 fix: 修正 defaultAgent 无法正常变更的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Sep 1, 2023
1 parent 360dd1c commit 788d94b
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/store/global/slices/agent.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { produce } from 'immer';
import { merge } from 'lodash-es';
import type { StateCreator } from 'zustand/vanilla';

import { LobeAgentSettings } from '@/types/session';
Expand All @@ -25,8 +24,7 @@ export const createAgentSlice: StateCreator<
> = (set, get) => ({
updateDefaultAgent: (agent) => {
const settings = produce(get().settings, (draft: GlobalSettings) => {
const oldAgent = draft.defaultAgent as LobeAgentSettings;
draft.defaultAgent = merge({}, oldAgent, agent);
draft.defaultAgent = { ...draft.defaultAgent, ...agent };
});

set({ settings }, false, t('updateDefaultAgent', agent));
Expand Down

0 comments on commit 788d94b

Please sign in to comment.