balibabu commited on
Commit
2480697
·
1 Parent(s): 2bf6c61

feat: Add message_history_window_size to CategorizeForm #1739 (#2826)

Browse files

### What problem does this PR solve?

feat: Add message_history_window_size to CategorizeForm #1739
### Type of change

- [ ] Bug Fix (non-breaking change which fixes an issue)
- [x] New Feature (non-breaking change which adds functionality)
- [ ] Documentation Update
- [ ] Refactoring
- [ ] Performance Improvement
- [ ] Other (please describe):

web/src/components/message-history-window-size-item.tsx ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { Form, InputNumber } from 'antd';
2
+ import { useTranslation } from 'react-i18next';
3
+
4
+ const MessageHistoryWindowSizeItem = ({
5
+ initialValue,
6
+ }: {
7
+ initialValue: number;
8
+ }) => {
9
+ const { t } = useTranslation('flow');
10
+
11
+ return (
12
+ <Form.Item
13
+ name={'message_history_window_size'}
14
+ label={t('messageHistoryWindowSize')}
15
+ initialValue={initialValue}
16
+ tooltip={t('messageHistoryWindowSizeTip')}
17
+ >
18
+ <InputNumber style={{ width: '100%' }} />
19
+ </Form.Item>
20
+ );
21
+ };
22
+
23
+ export default MessageHistoryWindowSizeItem;
web/src/pages/flow/constant.tsx CHANGED
@@ -366,6 +366,7 @@ export const initialRelevantValues = {
366
 
367
  export const initialCategorizeValues = {
368
  ...initialLlmBaseValues,
 
369
  category_description: {},
370
  };
371
 
 
366
 
367
  export const initialCategorizeValues = {
368
  ...initialLlmBaseValues,
369
+ message_history_window_size: 1,
370
  category_description: {},
371
  };
372
 
web/src/pages/flow/form/categorize-form/index.tsx CHANGED
@@ -1,4 +1,5 @@
1
  import LLMSelect from '@/components/llm-select';
 
2
  import { useTranslate } from '@/hooks/common-hooks';
3
  import { Form } from 'antd';
4
  import { useSetLlmSetting } from '../../hooks';
@@ -31,6 +32,9 @@ const CategorizeForm = ({ form, onValuesChange, node }: IOperatorForm) => {
31
  >
32
  <LLMSelect></LLMSelect>
33
  </Form.Item>
 
 
 
34
  <DynamicCategorize nodeId={node?.id}></DynamicCategorize>
35
  </Form>
36
  );
 
1
  import LLMSelect from '@/components/llm-select';
2
+ import MessageHistoryWindowSizeItem from '@/components/message-history-window-size-item';
3
  import { useTranslate } from '@/hooks/common-hooks';
4
  import { Form } from 'antd';
5
  import { useSetLlmSetting } from '../../hooks';
 
32
  >
33
  <LLMSelect></LLMSelect>
34
  </Form.Item>
35
+ <MessageHistoryWindowSizeItem
36
+ initialValue={1}
37
+ ></MessageHistoryWindowSizeItem>
38
  <DynamicCategorize nodeId={node?.id}></DynamicCategorize>
39
  </Form>
40
  );
web/src/pages/flow/form/generate-form/index.tsx CHANGED
@@ -1,6 +1,7 @@
1
  import LLMSelect from '@/components/llm-select';
 
2
  import { useTranslate } from '@/hooks/common-hooks';
3
- import { Form, Input, InputNumber, Switch } from 'antd';
4
  import { useSetLlmSetting } from '../../hooks';
5
  import { IOperatorForm } from '../../interface';
6
  import DynamicParameters from './dynamic-parameters';
@@ -48,14 +49,9 @@ const GenerateForm = ({ onValuesChange, form, node }: IOperatorForm) => {
48
  >
49
  <Switch />
50
  </Form.Item>
51
- <Form.Item
52
- name={'message_history_window_size'}
53
- label={t('messageHistoryWindowSize')}
54
  initialValue={12}
55
- tooltip={t('messageHistoryWindowSizeTip')}
56
- >
57
- <InputNumber style={{ width: '100%' }} />
58
- </Form.Item>
59
  <DynamicParameters nodeId={node?.id}></DynamicParameters>
60
  </Form>
61
  );
 
1
  import LLMSelect from '@/components/llm-select';
2
+ import MessageHistoryWindowSizeItem from '@/components/message-history-window-size-item';
3
  import { useTranslate } from '@/hooks/common-hooks';
4
+ import { Form, Input, Switch } from 'antd';
5
  import { useSetLlmSetting } from '../../hooks';
6
  import { IOperatorForm } from '../../interface';
7
  import DynamicParameters from './dynamic-parameters';
 
49
  >
50
  <Switch />
51
  </Form.Item>
52
+ <MessageHistoryWindowSizeItem
 
 
53
  initialValue={12}
54
+ ></MessageHistoryWindowSizeItem>
 
 
 
55
  <DynamicParameters nodeId={node?.id}></DynamicParameters>
56
  </Form>
57
  );