Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add message_history_window_size to CategorizeForm #1739 #2826

Merged
merged 2 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions web/src/components/message-history-window-size-item.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Form, InputNumber } from 'antd';
import { useTranslation } from 'react-i18next';

const MessageHistoryWindowSizeItem = ({
initialValue,
}: {
initialValue: number;
}) => {
const { t } = useTranslation('flow');

return (
<Form.Item
name={'message_history_window_size'}
label={t('messageHistoryWindowSize')}
initialValue={initialValue}
tooltip={t('messageHistoryWindowSizeTip')}
>
<InputNumber style={{ width: '100%' }} />
</Form.Item>
);
};

export default MessageHistoryWindowSizeItem;
1 change: 1 addition & 0 deletions web/src/pages/flow/constant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ export const initialRelevantValues = {

export const initialCategorizeValues = {
...initialLlmBaseValues,
message_history_window_size: 1,
category_description: {},
};

Expand Down
4 changes: 4 additions & 0 deletions web/src/pages/flow/form/categorize-form/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import LLMSelect from '@/components/llm-select';
import MessageHistoryWindowSizeItem from '@/components/message-history-window-size-item';
import { useTranslate } from '@/hooks/common-hooks';
import { Form } from 'antd';
import { useSetLlmSetting } from '../../hooks';
Expand Down Expand Up @@ -31,6 +32,9 @@ const CategorizeForm = ({ form, onValuesChange, node }: IOperatorForm) => {
>
<LLMSelect></LLMSelect>
</Form.Item>
<MessageHistoryWindowSizeItem
initialValue={1}
></MessageHistoryWindowSizeItem>
<DynamicCategorize nodeId={node?.id}></DynamicCategorize>
</Form>
);
Expand Down
12 changes: 4 additions & 8 deletions web/src/pages/flow/form/generate-form/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import LLMSelect from '@/components/llm-select';
import MessageHistoryWindowSizeItem from '@/components/message-history-window-size-item';
import { useTranslate } from '@/hooks/common-hooks';
import { Form, Input, InputNumber, Switch } from 'antd';
import { Form, Input, Switch } from 'antd';
import { useSetLlmSetting } from '../../hooks';
import { IOperatorForm } from '../../interface';
import DynamicParameters from './dynamic-parameters';
Expand Down Expand Up @@ -48,14 +49,9 @@ const GenerateForm = ({ onValuesChange, form, node }: IOperatorForm) => {
>
<Switch />
</Form.Item>
<Form.Item
name={'message_history_window_size'}
label={t('messageHistoryWindowSize')}
<MessageHistoryWindowSizeItem
initialValue={12}
tooltip={t('messageHistoryWindowSizeTip')}
>
<InputNumber style={{ width: '100%' }} />
</Form.Item>
></MessageHistoryWindowSizeItem>
<DynamicParameters nodeId={node?.id}></DynamicParameters>
</Form>
);
Expand Down