From 1f306143d59e43ff1afd77d1e88c5d6d12345ba2 Mon Sep 17 00:00:00 2001 From: CanisMinor Date: Fri, 14 Jun 2024 20:45:18 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20Fix=20enableMaxTokens=20i?= =?UTF-8?q?n=20agent=20setting=20(fix=20#2859)=20(#2870)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/AgentSetting/AgentModal/index.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/features/AgentSetting/AgentModal/index.tsx b/src/features/AgentSetting/AgentModal/index.tsx index 5e9941a16204..d2b560707d36 100644 --- a/src/features/AgentSetting/AgentModal/index.tsx +++ b/src/features/AgentSetting/AgentModal/index.tsx @@ -2,7 +2,6 @@ import { Form, ItemGroup, SliderWithInput } from '@lobehub/ui'; import { Switch } from 'antd'; -import { debounce } from 'lodash-es'; import { memo } from 'react'; import { useTranslation } from 'react-i18next'; @@ -17,10 +16,10 @@ const AgentModal = memo(() => { const { t } = useTranslation('setting'); const [form] = Form.useForm(); - const [enableMaxTokens, updateConfig] = useStore((s) => [ - selectors.chatConfig(s).enableMaxTokens, - s.setAgentConfig, - ]); + const [enableMaxTokens, updateConfig] = useStore((s) => { + const config = selectors.chatConfig(s); + return [config.enableMaxTokens, s.setAgentConfig]; + }); useAgentSyncSettings(form); @@ -65,7 +64,7 @@ const AgentModal = memo(() => { children: , label: t('settingModel.enableMaxTokens.title'), minWidth: undefined, - name: 'enableMaxTokens', + name: ['chatConfig', 'enableMaxTokens'], valuePropName: 'checked', }, { @@ -86,7 +85,7 @@ const AgentModal = memo(() => { form={form} items={[model]} itemsType={'group'} - onValuesChange={debounce(updateConfig, 100)} + onValuesChange={updateConfig} variant={'pure'} {...FORM_STYLE} />