balibabu commited on
Commit
86d0fad
·
1 Parent(s): fbb1e63

fix: add message_history_window_size to GenerateForm #1472 (#1487)

Browse files

### What problem does this PR solve?
fix: add message_history_window_size to GenerateForm #1472
### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

web/src/locales/en.ts CHANGED
@@ -609,6 +609,9 @@ The above is the content you need to summarize.`,
609
  channelTip: `Perform text search or news search on the component's input`,
610
  text: 'Text',
611
  news: 'News',
 
 
 
612
  },
613
  footer: {
614
  profile: 'All rights reserved @ React',
 
609
  channelTip: `Perform text search or news search on the component's input`,
610
  text: 'Text',
611
  news: 'News',
612
+ messageHistoryWindowSize: 'Message window size',
613
+ messageHistoryWindowSizeTip:
614
+ 'The window size of conversation history that needed to be seen by LLM. The larger the better. But be careful with the maximum content length of LLM.',
615
  },
616
  footer: {
617
  profile: 'All rights reserved @ React',
web/src/locales/zh-traditional.ts CHANGED
@@ -570,6 +570,9 @@ export default {
570
  channelTip: '針對該組件的輸入進行文字搜尋或新聞搜索',
571
  text: '文字',
572
  news: '新聞',
 
 
 
573
  },
574
  footer: {
575
  profile: '“保留所有權利 @ react”',
 
570
  channelTip: '針對該組件的輸入進行文字搜尋或新聞搜索',
571
  text: '文字',
572
  news: '新聞',
573
+ messageHistoryWindowSize: '歷史訊息視窗大小',
574
+ messageHistoryWindowSizeTip:
575
+ 'LLM需要查看的對話記錄的視窗大小。越大越好。但要注意LLM的最大內容長度。',
576
  },
577
  footer: {
578
  profile: '“保留所有權利 @ react”',
web/src/locales/zh.ts CHANGED
@@ -588,6 +588,9 @@ export default {
588
  channelTip: '针对该组件的输入进行文本搜索或新闻搜索',
589
  text: '文本',
590
  news: '新闻',
 
 
 
591
  },
592
  footer: {
593
  profile: 'All rights reserved @ React',
 
588
  channelTip: '针对该组件的输入进行文本搜索或新闻搜索',
589
  text: '文本',
590
  news: '新闻',
591
+ messageHistoryWindowSize: '历史消息窗口大小',
592
+ messageHistoryWindowSizeTip:
593
+ 'LLM 需要查看的对话历史窗口大小。越大越好。但要注意 LLM 的最大内容长度。',
594
  },
595
  footer: {
596
  profile: 'All rights reserved @ React',
web/src/pages/flow/constant.tsx CHANGED
@@ -2,6 +2,8 @@ import { ReactComponent as BaiduIcon } from '@/assets/svg/baidu.svg';
2
  import { ReactComponent as DuckIcon } from '@/assets/svg/duck.svg';
3
  import { ReactComponent as KeywordIcon } from '@/assets/svg/keyword.svg';
4
  import { variableEnabledFieldMap } from '@/constants/chat';
 
 
5
  import {
6
  BranchesOutlined,
7
  DatabaseOutlined,
@@ -162,10 +164,9 @@ const initialLlmBaseValues = {
162
 
163
  export const initialGenerateValues = {
164
  ...initialLlmBaseValues,
165
- prompt: `Please summarize the following paragraphs. Be careful with the numbers, do not make things up. Paragraphs as following:
166
- {input}
167
- The above is the content you need to summarize.`,
168
  cite: true,
 
169
  parameters: [],
170
  };
171
 
 
2
  import { ReactComponent as DuckIcon } from '@/assets/svg/duck.svg';
3
  import { ReactComponent as KeywordIcon } from '@/assets/svg/keyword.svg';
4
  import { variableEnabledFieldMap } from '@/constants/chat';
5
+ import i18n from '@/locales/config';
6
+
7
  import {
8
  BranchesOutlined,
9
  DatabaseOutlined,
 
164
 
165
  export const initialGenerateValues = {
166
  ...initialLlmBaseValues,
167
+ prompt: i18n.t('flow.promptText'),
 
 
168
  cite: true,
169
+ message_history_window_size: 12,
170
  parameters: [],
171
  };
172
 
web/src/pages/flow/generate-form/index.tsx CHANGED
@@ -1,6 +1,6 @@
1
  import LLMSelect from '@/components/llm-select';
2
  import { useTranslate } from '@/hooks/commonHooks';
3
- import { Form, Input, Switch } from 'antd';
4
  import { useSetLlmSetting } from '../hooks';
5
  import { IOperatorForm } from '../interface';
6
  import DynamicParameters from './dynamic-parameters';
@@ -13,8 +13,8 @@ const GenerateForm = ({ onValuesChange, form, node }: IOperatorForm) => {
13
  return (
14
  <Form
15
  name="basic"
16
- labelCol={{ span: 5 }}
17
- wrapperCol={{ span: 19 }}
18
  autoComplete="off"
19
  form={form}
20
  onValuesChange={onValuesChange}
@@ -49,6 +49,14 @@ const GenerateForm = ({ onValuesChange, form, node }: IOperatorForm) => {
49
  >
50
  <Switch />
51
  </Form.Item>
 
 
 
 
 
 
 
 
52
  <DynamicParameters nodeId={node?.id}></DynamicParameters>
53
  </Form>
54
  );
 
1
  import LLMSelect from '@/components/llm-select';
2
  import { useTranslate } from '@/hooks/commonHooks';
3
+ import { Form, Input, InputNumber, Switch } from 'antd';
4
  import { useSetLlmSetting } from '../hooks';
5
  import { IOperatorForm } from '../interface';
6
  import DynamicParameters from './dynamic-parameters';
 
13
  return (
14
  <Form
15
  name="basic"
16
+ labelCol={{ span: 10 }}
17
+ wrapperCol={{ span: 14 }}
18
  autoComplete="off"
19
  form={form}
20
  onValuesChange={onValuesChange}
 
49
  >
50
  <Switch />
51
  </Form.Item>
52
+ <Form.Item
53
+ name={'message_history_window_size'}
54
+ label={t('messageHistoryWindowSize')}
55
+ initialValue={12}
56
+ tooltip={t('messageHistoryWindowSizeTip')}
57
+ >
58
+ <InputNumber style={{ width: '100%' }} />
59
+ </Form.Item>
60
  <DynamicParameters nodeId={node?.id}></DynamicParameters>
61
  </Form>
62
  );