Skip to content

Commit

Permalink
🐛 fix: Fix enableMaxTokens in agent setting (fix lobehub#2859) (lobeh…
Browse files Browse the repository at this point in the history
  • Loading branch information
canisminor1990 committed Jun 14, 2024
1 parent 920d60f commit 1f30614
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/features/AgentSetting/AgentModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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);

Expand Down Expand Up @@ -65,7 +64,7 @@ const AgentModal = memo(() => {
children: <Switch />,
label: t('settingModel.enableMaxTokens.title'),
minWidth: undefined,
name: 'enableMaxTokens',
name: ['chatConfig', 'enableMaxTokens'],
valuePropName: 'checked',
},
{
Expand All @@ -86,7 +85,7 @@ const AgentModal = memo(() => {
form={form}
items={[model]}
itemsType={'group'}
onValuesChange={debounce(updateConfig, 100)}
onValuesChange={updateConfig}
variant={'pure'}
{...FORM_STYLE}
/>
Expand Down

0 comments on commit 1f30614

Please sign in to comment.