balibabu commited on
Commit
a2c2382
·
1 Parent(s): eb1f8d0

feat: Add DynamicInputVariable to RetrievalForm #1739 (#3112)

Browse files

### What problem does this PR solve?

feat: Add DynamicInputVariable to RetrievalForm #1739
### Type of change

- [x] New Feature (non-breaking change which adds functionality)

Files changed (29) hide show
  1. web/src/locales/en.ts +5 -1
  2. web/src/locales/zh-traditional.ts +5 -1
  3. web/src/locales/zh.ts +5 -1
  4. web/src/pages/flow/constant.tsx +29 -2
  5. web/src/pages/flow/form/akshare-form/index.tsx +4 -3
  6. web/src/pages/flow/form/arxiv-form/index.tsx +5 -3
  7. web/src/pages/flow/form/baidu-fanyi-form/index.tsx +4 -3
  8. web/src/pages/flow/form/baidu-form/index.tsx +4 -3
  9. web/src/pages/flow/form/bing-form/index.tsx +4 -3
  10. web/src/pages/flow/form/categorize-form/dynamic-categorize.tsx +3 -2
  11. web/src/pages/flow/form/categorize-form/index.tsx +2 -0
  12. web/src/pages/flow/form/components/dynamic-input-variable.tsx +116 -0
  13. web/src/pages/flow/form/components/index.less +22 -0
  14. web/src/pages/flow/form/crawler-form/index.tsx +4 -3
  15. web/src/pages/flow/form/deepl-form/index.tsx +4 -3
  16. web/src/pages/flow/form/duckduckgo-form/index.tsx +4 -3
  17. web/src/pages/flow/form/exesql-form/index.tsx +4 -3
  18. web/src/pages/flow/form/github-form/index.tsx +4 -3
  19. web/src/pages/flow/form/google-form/index.tsx +4 -3
  20. web/src/pages/flow/form/google-scholar-form/index.tsx +4 -3
  21. web/src/pages/flow/form/jin10-form/index.tsx +4 -3
  22. web/src/pages/flow/form/keyword-extract-form/index.tsx +4 -3
  23. web/src/pages/flow/form/pubmed-form/index.tsx +4 -3
  24. web/src/pages/flow/form/qweather-form/index.tsx +4 -3
  25. web/src/pages/flow/form/retrieval-form/index.tsx +3 -1
  26. web/src/pages/flow/form/tushare-form/index.tsx +4 -3
  27. web/src/pages/flow/form/wencai-form/index.tsx +4 -3
  28. web/src/pages/flow/form/wikipedia-form/index.tsx +4 -3
  29. web/src/pages/flow/form/yahoo-finance-form/index.tsx +4 -3
web/src/locales/en.ts CHANGED
@@ -30,6 +30,8 @@ export default {
30
  warn: 'Warn',
31
  action: 'Action',
32
  s: 'S',
 
 
33
  },
34
  login: {
35
  login: 'Sign in',
@@ -744,7 +746,7 @@ The above is the content you need to summarize.`,
744
  googleDescription:
745
  'This component is used to get search result fromhttps://www.google.com/ . Typically, it performs as a supplement to knowledgebases. Top N and SerpApi API key specifies the number of search results you need to adapt.',
746
  bing: 'Bing',
747
- bingTip:
748
  'This component is used to get search result from https://www.bing.com/. Typically, it performs as a supplement to knowledgebases. Top N and Bing Subscription-Key specifies the number of search results you need to adapt.',
749
  apiKey: 'API KEY',
750
  country: 'Country',
@@ -1024,6 +1026,8 @@ The above is the content you need to summarize.`,
1024
  timeout: 'Timeout',
1025
  headers: 'Headers',
1026
  cleanHtml: 'Clean html',
 
 
1027
  },
1028
  footer: {
1029
  profile: 'All rights reserved @ React',
 
30
  warn: 'Warn',
31
  action: 'Action',
32
  s: 'S',
33
+ pleaseSelect: 'Please select',
34
+ pleaseInput: 'Please input',
35
  },
36
  login: {
37
  login: 'Sign in',
 
746
  googleDescription:
747
  'This component is used to get search result fromhttps://www.google.com/ . Typically, it performs as a supplement to knowledgebases. Top N and SerpApi API key specifies the number of search results you need to adapt.',
748
  bing: 'Bing',
749
+ bingDescription:
750
  'This component is used to get search result from https://www.bing.com/. Typically, it performs as a supplement to knowledgebases. Top N and Bing Subscription-Key specifies the number of search results you need to adapt.',
751
  apiKey: 'API KEY',
752
  country: 'Country',
 
1026
  timeout: 'Timeout',
1027
  headers: 'Headers',
1028
  cleanHtml: 'Clean html',
1029
+ reference: 'Reference',
1030
+ input: 'Input',
1031
  },
1032
  footer: {
1033
  profile: 'All rights reserved @ React',
web/src/locales/zh-traditional.ts CHANGED
@@ -30,6 +30,8 @@ export default {
30
  warn: '提醒',
31
  action: '操作',
32
  s: '秒',
 
 
33
  },
34
  login: {
35
  login: '登入',
@@ -697,7 +699,7 @@ export default {
697
  googleDescription:
698
  '此元件用於從https://www.google.com/取得搜尋結果。通常,它作為知識庫的補充。 Top N 和 SerpApi API 金鑰指定您需要調整的搜尋結果數量。',
699
  bing: 'Bing',
700
- bingTip:
701
  '此元件用於從 https://www.bing.com/ 取得搜尋結果。通常,它充當知識庫的補充。 Top N 和 Bing Subscription-Key 指定您需要適配的搜尋結果數量。',
702
  apiKey: 'API KEY',
703
  country: '國家',
@@ -973,6 +975,8 @@ export default {
973
  timeout: '超時',
974
  headers: '請求頭',
975
  cleanHtml: '清除 html',
 
 
976
  },
977
  footer: {
978
  profile: '“保留所有權利 @ react”',
 
30
  warn: '提醒',
31
  action: '操作',
32
  s: '秒',
33
+ pleaseSelect: '請選擇',
34
+ pleaseInput: '請輸入',
35
  },
36
  login: {
37
  login: '登入',
 
699
  googleDescription:
700
  '此元件用於從https://www.google.com/取得搜尋結果。通常,它作為知識庫的補充。 Top N 和 SerpApi API 金鑰指定您需要調整的搜尋結果數量。',
701
  bing: 'Bing',
702
+ bingDescription:
703
  '此元件用於從 https://www.bing.com/ 取得搜尋結果。通常,它充當知識庫的補充。 Top N 和 Bing Subscription-Key 指定您需要適配的搜尋結果數量。',
704
  apiKey: 'API KEY',
705
  country: '國家',
 
975
  timeout: '超時',
976
  headers: '請求頭',
977
  cleanHtml: '清除 html',
978
+ reference: '引用',
979
+ input: '輸入',
980
  },
981
  footer: {
982
  profile: '“保留所有權利 @ react”',
web/src/locales/zh.ts CHANGED
@@ -30,6 +30,8 @@ export default {
30
  warn: '提醒',
31
  action: '操作',
32
  s: '秒',
 
 
33
  },
34
  login: {
35
  login: '登录',
@@ -717,7 +719,7 @@ export default {
717
  googleDescription:
718
  '此组件用于从https://www.google.com/获取搜索结果。通常,它作为知识库的补充。Top N 和 SerpApi API 密钥指定您需要调整的搜索结果数量。',
719
  bing: 'Bing',
720
- bingTip:
721
  '此组件用于从 https://www.bing.com/ 获取搜索结果。通常,它作为知识库的补充。Top N 和 Bing Subscription-Key 指定您需要调整的搜索结果数量。',
722
  apiKey: 'API KEY',
723
  country: '国家',
@@ -993,6 +995,8 @@ export default {
993
  timeout: '超时',
994
  headers: '请求头',
995
  cleanHtml: '清除 html',
 
 
996
  },
997
  footer: {
998
  profile: 'All rights reserved @ React',
 
30
  warn: '提醒',
31
  action: '操作',
32
  s: '秒',
33
+ pleaseSelect: '请选择',
34
+ pleaseInput: '请输入',
35
  },
36
  login: {
37
  login: '登录',
 
719
  googleDescription:
720
  '此组件用于从https://www.google.com/获取搜索结果。通常,它作为知识库的补充。Top N 和 SerpApi API 密钥指定您需要调整的搜索结果数量。',
721
  bing: 'Bing',
722
+ bingDescription:
723
  '此组件用于从 https://www.bing.com/ 获取搜索结果。通常,它作为知识库的补充。Top N 和 Bing Subscription-Key 指定您需要调整的搜索结果数量。',
724
  apiKey: 'API KEY',
725
  country: '国家',
 
995
  timeout: '超时',
996
  headers: '请求头',
997
  cleanHtml: '清除 html',
998
+ reference: '引用',
999
+ input: '输入',
1000
  },
1001
  footer: {
1002
  profile: 'All rights reserved @ React',
web/src/pages/flow/constant.tsx CHANGED
@@ -343,10 +343,15 @@ export const componentMenuList = [
343
  },
344
  ];
345
 
 
 
 
 
346
  export const initialRetrievalValues = {
347
  similarity_threshold: 0.2,
348
  keywords_similarity_weight: 0.3,
349
  top_n: 8,
 
350
  };
351
 
352
  export const initialBeginValues = {
@@ -390,6 +395,7 @@ export const initialCategorizeValues = {
390
  ...initialLlmBaseValues,
391
  message_history_window_size: 1,
392
  category_description: {},
 
393
  };
394
 
395
  export const initialMessageValues = {
@@ -399,29 +405,35 @@ export const initialMessageValues = {
399
  export const initialKeywordExtractValues = {
400
  ...initialLlmBaseValues,
401
  top_n: 1,
 
402
  };
403
  export const initialDuckValues = {
404
  top_n: 10,
405
  channel: Channel.Text,
 
406
  };
407
 
408
  export const initialBaiduValues = {
409
  top_n: 10,
 
410
  };
411
 
412
  export const initialWikipediaValues = {
413
  top_n: 10,
414
  language: 'en',
 
415
  };
416
 
417
  export const initialPubMedValues = {
418
  top_n: 10,
419
  email: '',
 
420
  };
421
 
422
  export const initialArXivValues = {
423
  top_n: 10,
424
  sort_by: 'relevance',
 
425
  };
426
 
427
  export const initialGoogleValues = {
@@ -429,6 +441,7 @@ export const initialGoogleValues = {
429
  api_key: 'Xxx(get from https://serpapi.com/manage-api-key)',
430
  country: 'cn',
431
  language: 'en',
 
432
  };
433
 
434
  export const initialBingValues = {
@@ -438,12 +451,14 @@ export const initialBingValues = {
438
  '"YOUR_ACCESS_KEY"(get from https://www.microsoft.com/en-us/bing/apis/bing-web-search-api)',
439
  country: 'CH',
440
  language: 'en',
 
441
  };
442
 
443
  export const initialGoogleScholarValues = {
444
  top_n: 5,
445
  sort_by: 'relevance',
446
  patents: true,
 
447
  };
448
 
449
  export const initialDeepLValues = {
@@ -453,12 +468,14 @@ export const initialDeepLValues = {
453
 
454
  export const initialGithubValues = {
455
  top_n: 5,
 
456
  };
457
 
458
  export const initialBaiduFanyiValues = {
459
  appid: 'xxx',
460
  secret_key: 'xxx',
461
  trans_type: 'translate',
 
462
  };
463
 
464
  export const initialQWeatherValues = {
@@ -466,6 +483,7 @@ export const initialQWeatherValues = {
466
  type: 'weather',
467
  user_type: 'free',
468
  time_period: 'now',
 
469
  };
470
 
471
  export const initialExeSqlValues = {
@@ -477,13 +495,18 @@ export const initialExeSqlValues = {
477
  password: '',
478
  loop: 3,
479
  top_n: 30,
 
480
  };
481
 
482
  export const initialSwitchValues = { conditions: [] };
483
 
484
- export const initialWenCaiValues = { top_n: 20, query_type: 'stock' };
 
 
 
 
485
 
486
- export const initialAkShareValues = { top_n: 10 };
487
 
488
  export const initialYahooFinanceValues = {
489
  info: true,
@@ -492,6 +515,7 @@ export const initialYahooFinanceValues = {
492
  balance_sheet: false,
493
  cash_flow_statement: false,
494
  news: true,
 
495
  };
496
 
497
  export const initialJin10Values = {
@@ -500,6 +524,7 @@ export const initialJin10Values = {
500
  flash_type: '1',
501
  contain: '',
502
  filter: '',
 
503
  };
504
 
505
  export const initialConcentratorValues = {};
@@ -508,6 +533,7 @@ export const initialTuShareValues = {
508
  token: 'xxx',
509
  src: 'eastmoney',
510
  start_date: '2024-01-01 09:00:00',
 
511
  };
512
 
513
  export const initialNoteValues = {
@@ -516,6 +542,7 @@ export const initialNoteValues = {
516
 
517
  export const initialCrawlerValues = {
518
  extract_type: 'markdown',
 
519
  };
520
 
521
  export const initialInvokeValues = {
 
343
  },
344
  ];
345
 
346
+ const initialQueryBaseValues = {
347
+ query: [],
348
+ };
349
+
350
  export const initialRetrievalValues = {
351
  similarity_threshold: 0.2,
352
  keywords_similarity_weight: 0.3,
353
  top_n: 8,
354
+ ...initialQueryBaseValues,
355
  };
356
 
357
  export const initialBeginValues = {
 
395
  ...initialLlmBaseValues,
396
  message_history_window_size: 1,
397
  category_description: {},
398
+ ...initialQueryBaseValues,
399
  };
400
 
401
  export const initialMessageValues = {
 
405
  export const initialKeywordExtractValues = {
406
  ...initialLlmBaseValues,
407
  top_n: 1,
408
+ ...initialQueryBaseValues,
409
  };
410
  export const initialDuckValues = {
411
  top_n: 10,
412
  channel: Channel.Text,
413
+ ...initialQueryBaseValues,
414
  };
415
 
416
  export const initialBaiduValues = {
417
  top_n: 10,
418
+ ...initialQueryBaseValues,
419
  };
420
 
421
  export const initialWikipediaValues = {
422
  top_n: 10,
423
  language: 'en',
424
+ ...initialQueryBaseValues,
425
  };
426
 
427
  export const initialPubMedValues = {
428
  top_n: 10,
429
  email: '',
430
+ ...initialQueryBaseValues,
431
  };
432
 
433
  export const initialArXivValues = {
434
  top_n: 10,
435
  sort_by: 'relevance',
436
+ ...initialQueryBaseValues,
437
  };
438
 
439
  export const initialGoogleValues = {
 
441
  api_key: 'Xxx(get from https://serpapi.com/manage-api-key)',
442
  country: 'cn',
443
  language: 'en',
444
+ ...initialQueryBaseValues,
445
  };
446
 
447
  export const initialBingValues = {
 
451
  '"YOUR_ACCESS_KEY"(get from https://www.microsoft.com/en-us/bing/apis/bing-web-search-api)',
452
  country: 'CH',
453
  language: 'en',
454
+ ...initialQueryBaseValues,
455
  };
456
 
457
  export const initialGoogleScholarValues = {
458
  top_n: 5,
459
  sort_by: 'relevance',
460
  patents: true,
461
+ ...initialQueryBaseValues,
462
  };
463
 
464
  export const initialDeepLValues = {
 
468
 
469
  export const initialGithubValues = {
470
  top_n: 5,
471
+ ...initialQueryBaseValues,
472
  };
473
 
474
  export const initialBaiduFanyiValues = {
475
  appid: 'xxx',
476
  secret_key: 'xxx',
477
  trans_type: 'translate',
478
+ ...initialQueryBaseValues,
479
  };
480
 
481
  export const initialQWeatherValues = {
 
483
  type: 'weather',
484
  user_type: 'free',
485
  time_period: 'now',
486
+ ...initialQueryBaseValues,
487
  };
488
 
489
  export const initialExeSqlValues = {
 
495
  password: '',
496
  loop: 3,
497
  top_n: 30,
498
+ ...initialQueryBaseValues,
499
  };
500
 
501
  export const initialSwitchValues = { conditions: [] };
502
 
503
+ export const initialWenCaiValues = {
504
+ top_n: 20,
505
+ query_type: 'stock',
506
+ ...initialQueryBaseValues,
507
+ };
508
 
509
+ export const initialAkShareValues = { top_n: 10, ...initialQueryBaseValues };
510
 
511
  export const initialYahooFinanceValues = {
512
  info: true,
 
515
  balance_sheet: false,
516
  cash_flow_statement: false,
517
  news: true,
518
+ ...initialQueryBaseValues,
519
  };
520
 
521
  export const initialJin10Values = {
 
524
  flash_type: '1',
525
  contain: '',
526
  filter: '',
527
+ ...initialQueryBaseValues,
528
  };
529
 
530
  export const initialConcentratorValues = {};
 
533
  token: 'xxx',
534
  src: 'eastmoney',
535
  start_date: '2024-01-01 09:00:00',
536
+ ...initialQueryBaseValues,
537
  };
538
 
539
  export const initialNoteValues = {
 
542
 
543
  export const initialCrawlerValues = {
544
  extract_type: 'markdown',
545
+ ...initialQueryBaseValues,
546
  };
547
 
548
  export const initialInvokeValues = {
web/src/pages/flow/form/akshare-form/index.tsx CHANGED
@@ -1,17 +1,18 @@
1
  import TopNItem from '@/components/top-n-item';
2
  import { Form } from 'antd';
3
  import { IOperatorForm } from '../../interface';
 
4
 
5
- const AkShareForm = ({ onValuesChange, form }: IOperatorForm) => {
6
  return (
7
  <Form
8
  name="basic"
9
- labelCol={{ span: 6 }}
10
- wrapperCol={{ span: 18 }}
11
  autoComplete="off"
12
  form={form}
13
  onValuesChange={onValuesChange}
 
14
  >
 
15
  <TopNItem initialValue={10} max={99}></TopNItem>
16
  </Form>
17
  );
 
1
  import TopNItem from '@/components/top-n-item';
2
  import { Form } from 'antd';
3
  import { IOperatorForm } from '../../interface';
4
+ import DynamicInputVariable from '../components/dynamic-input-variable';
5
 
6
+ const AkShareForm = ({ onValuesChange, form, node }: IOperatorForm) => {
7
  return (
8
  <Form
9
  name="basic"
 
 
10
  autoComplete="off"
11
  form={form}
12
  onValuesChange={onValuesChange}
13
+ layout={'vertical'}
14
  >
15
+ <DynamicInputVariable nodeId={node?.id}></DynamicInputVariable>
16
  <TopNItem initialValue={10} max={99}></TopNItem>
17
  </Form>
18
  );
web/src/pages/flow/form/arxiv-form/index.tsx CHANGED
@@ -3,8 +3,9 @@ import { useTranslate } from '@/hooks/common-hooks';
3
  import { Form, Select } from 'antd';
4
  import { useMemo } from 'react';
5
  import { IOperatorForm } from '../../interface';
 
6
 
7
- const ArXivForm = ({ onValuesChange, form }: IOperatorForm) => {
8
  const { t } = useTranslate('flow');
9
 
10
  const options = useMemo(() => {
@@ -17,12 +18,13 @@ const ArXivForm = ({ onValuesChange, form }: IOperatorForm) => {
17
  return (
18
  <Form
19
  name="basic"
20
- labelCol={{ span: 6 }}
21
- wrapperCol={{ span: 18 }}
22
  autoComplete="off"
23
  form={form}
24
  onValuesChange={onValuesChange}
 
25
  >
 
 
26
  <TopNItem initialValue={10}></TopNItem>
27
  <Form.Item label={t('sortBy')} name={'sort_by'}>
28
  <Select options={options}></Select>
 
3
  import { Form, Select } from 'antd';
4
  import { useMemo } from 'react';
5
  import { IOperatorForm } from '../../interface';
6
+ import DynamicInputVariable from '../components/dynamic-input-variable';
7
 
8
+ const ArXivForm = ({ onValuesChange, form, node }: IOperatorForm) => {
9
  const { t } = useTranslate('flow');
10
 
11
  const options = useMemo(() => {
 
18
  return (
19
  <Form
20
  name="basic"
 
 
21
  autoComplete="off"
22
  form={form}
23
  onValuesChange={onValuesChange}
24
+ layout={'vertical'}
25
  >
26
+ <DynamicInputVariable nodeId={node?.id}></DynamicInputVariable>
27
+
28
  <TopNItem initialValue={10}></TopNItem>
29
  <Form.Item label={t('sortBy')} name={'sort_by'}>
30
  <Select options={options}></Select>
web/src/pages/flow/form/baidu-fanyi-form/index.tsx CHANGED
@@ -6,8 +6,9 @@ import {
6
  BaiduFanyiSourceLangOptions,
7
  } from '../../constant';
8
  import { IOperatorForm } from '../../interface';
 
9
 
10
- const BaiduFanyiForm = ({ onValuesChange, form }: IOperatorForm) => {
11
  const { t } = useTranslate('flow');
12
  const options = useMemo(() => {
13
  return ['translate', 'fieldtranslate'].map((x) => ({
@@ -33,12 +34,12 @@ const BaiduFanyiForm = ({ onValuesChange, form }: IOperatorForm) => {
33
  return (
34
  <Form
35
  name="basic"
36
- labelCol={{ span: 8 }}
37
- wrapperCol={{ span: 16 }}
38
  autoComplete="off"
39
  form={form}
40
  onValuesChange={onValuesChange}
 
41
  >
 
42
  <Form.Item label={t('appid')} name={'appid'}>
43
  <Input></Input>
44
  </Form.Item>
 
6
  BaiduFanyiSourceLangOptions,
7
  } from '../../constant';
8
  import { IOperatorForm } from '../../interface';
9
+ import DynamicInputVariable from '../components/dynamic-input-variable';
10
 
11
+ const BaiduFanyiForm = ({ onValuesChange, form, node }: IOperatorForm) => {
12
  const { t } = useTranslate('flow');
13
  const options = useMemo(() => {
14
  return ['translate', 'fieldtranslate'].map((x) => ({
 
34
  return (
35
  <Form
36
  name="basic"
 
 
37
  autoComplete="off"
38
  form={form}
39
  onValuesChange={onValuesChange}
40
+ layout={'vertical'}
41
  >
42
+ <DynamicInputVariable nodeId={node?.id}></DynamicInputVariable>
43
  <Form.Item label={t('appid')} name={'appid'}>
44
  <Input></Input>
45
  </Form.Item>
web/src/pages/flow/form/baidu-form/index.tsx CHANGED
@@ -1,17 +1,18 @@
1
  import TopNItem from '@/components/top-n-item';
2
  import { Form } from 'antd';
3
  import { IOperatorForm } from '../../interface';
 
4
 
5
- const BaiduForm = ({ onValuesChange, form }: IOperatorForm) => {
6
  return (
7
  <Form
8
  name="basic"
9
- labelCol={{ span: 6 }}
10
- wrapperCol={{ span: 18 }}
11
  autoComplete="off"
12
  form={form}
13
  onValuesChange={onValuesChange}
 
14
  >
 
15
  <TopNItem initialValue={10}></TopNItem>
16
  </Form>
17
  );
 
1
  import TopNItem from '@/components/top-n-item';
2
  import { Form } from 'antd';
3
  import { IOperatorForm } from '../../interface';
4
+ import DynamicInputVariable from '../components/dynamic-input-variable';
5
 
6
+ const BaiduForm = ({ onValuesChange, form, node }: IOperatorForm) => {
7
  return (
8
  <Form
9
  name="basic"
 
 
10
  autoComplete="off"
11
  form={form}
12
  onValuesChange={onValuesChange}
13
+ layout={'vertical'}
14
  >
15
+ <DynamicInputVariable nodeId={node?.id}></DynamicInputVariable>
16
  <TopNItem initialValue={10}></TopNItem>
17
  </Form>
18
  );
web/src/pages/flow/form/bing-form/index.tsx CHANGED
@@ -4,8 +4,9 @@ import { Form, Input, Select } from 'antd';
4
  import { useMemo } from 'react';
5
  import { BingCountryOptions, BingLanguageOptions } from '../../constant';
6
  import { IOperatorForm } from '../../interface';
 
7
 
8
- const BingForm = ({ onValuesChange, form }: IOperatorForm) => {
9
  const { t } = useTranslate('flow');
10
 
11
  const options = useMemo(() => {
@@ -15,12 +16,12 @@ const BingForm = ({ onValuesChange, form }: IOperatorForm) => {
15
  return (
16
  <Form
17
  name="basic"
18
- labelCol={{ span: 6 }}
19
- wrapperCol={{ span: 18 }}
20
  autoComplete="off"
21
  form={form}
22
  onValuesChange={onValuesChange}
 
23
  >
 
24
  <TopNItem initialValue={10}></TopNItem>
25
  <Form.Item label={t('channel')} name={'channel'}>
26
  <Select options={options}></Select>
 
4
  import { useMemo } from 'react';
5
  import { BingCountryOptions, BingLanguageOptions } from '../../constant';
6
  import { IOperatorForm } from '../../interface';
7
+ import DynamicInputVariable from '../components/dynamic-input-variable';
8
 
9
+ const BingForm = ({ onValuesChange, form, node }: IOperatorForm) => {
10
  const { t } = useTranslate('flow');
11
 
12
  const options = useMemo(() => {
 
16
  return (
17
  <Form
18
  name="basic"
 
 
19
  autoComplete="off"
20
  form={form}
21
  onValuesChange={onValuesChange}
22
+ layout={'vertical'}
23
  >
24
+ <DynamicInputVariable nodeId={node?.id}></DynamicInputVariable>
25
  <TopNItem initialValue={10}></TopNItem>
26
  <Form.Item label={t('channel')} name={'channel'}>
27
  <Select options={options}></Select>
web/src/pages/flow/form/categorize-form/dynamic-categorize.tsx CHANGED
@@ -1,5 +1,5 @@
1
  import { useTranslate } from '@/hooks/common-hooks';
2
- import { CloseOutlined } from '@ant-design/icons';
3
  import {
4
  Button,
5
  Card,
@@ -197,8 +197,9 @@ const DynamicCategorize = ({ nodeId }: IProps) => {
197
  onClick={handleAdd}
198
  block
199
  className={styles.addButton}
 
200
  >
201
- + {t('addItem')}
202
  </Button>
203
  </Flex>
204
  );
 
1
  import { useTranslate } from '@/hooks/common-hooks';
2
+ import { CloseOutlined, PlusOutlined } from '@ant-design/icons';
3
  import {
4
  Button,
5
  Card,
 
197
  onClick={handleAdd}
198
  block
199
  className={styles.addButton}
200
+ icon={<PlusOutlined />}
201
  >
202
+ {t('addItem')}
203
  </Button>
204
  </Flex>
205
  );
web/src/pages/flow/form/categorize-form/index.tsx CHANGED
@@ -4,6 +4,7 @@ import { useTranslate } from '@/hooks/common-hooks';
4
  import { Form } from 'antd';
5
  import { useSetLlmSetting } from '../../hooks';
6
  import { IOperatorForm } from '../../interface';
 
7
  import DynamicCategorize from './dynamic-categorize';
8
  import { useHandleFormValuesChange } from './hooks';
9
 
@@ -25,6 +26,7 @@ const CategorizeForm = ({ form, onValuesChange, node }: IOperatorForm) => {
25
  initialValues={{ items: [{}] }}
26
  layout={'vertical'}
27
  >
 
28
  <Form.Item
29
  name={'llm_id'}
30
  label={t('model', { keyPrefix: 'chat' })}
 
4
  import { Form } from 'antd';
5
  import { useSetLlmSetting } from '../../hooks';
6
  import { IOperatorForm } from '../../interface';
7
+ import DynamicInputVariable from '../components/dynamic-input-variable';
8
  import DynamicCategorize from './dynamic-categorize';
9
  import { useHandleFormValuesChange } from './hooks';
10
 
 
26
  initialValues={{ items: [{}] }}
27
  layout={'vertical'}
28
  >
29
+ <DynamicInputVariable nodeId={node?.id}></DynamicInputVariable>
30
  <Form.Item
31
  name={'llm_id'}
32
  label={t('model', { keyPrefix: 'chat' })}
web/src/pages/flow/form/components/dynamic-input-variable.tsx ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
2
+ import { Button, Collapse, Flex, Form, Input, Select } from 'antd';
3
+
4
+ import { useCallback } from 'react';
5
+ import { useTranslation } from 'react-i18next';
6
+ import { useBuildComponentIdSelectOptions } from '../../hooks';
7
+ import styles from './index.less';
8
+
9
+ interface IProps {
10
+ nodeId?: string;
11
+ }
12
+
13
+ enum VariableType {
14
+ Reference = 'reference',
15
+ Input = 'input',
16
+ }
17
+
18
+ const getVariableName = (type: string) =>
19
+ type === VariableType.Reference ? 'component_id' : 'value';
20
+
21
+ const DynamicVariableForm = ({ nodeId }: IProps) => {
22
+ const { t } = useTranslation();
23
+ const valueOptions = useBuildComponentIdSelectOptions(nodeId);
24
+ const form = Form.useFormInstance();
25
+
26
+ const options = [
27
+ { value: VariableType.Reference, label: t('flow.reference') },
28
+ { value: VariableType.Input, label: t('flow.input') },
29
+ ];
30
+
31
+ const handleTypeChange = useCallback(
32
+ (name: number) => () => {
33
+ setTimeout(() => {
34
+ form.setFieldValue(['query', name, 'component_id'], undefined);
35
+ form.setFieldValue(['query', name, 'value'], undefined);
36
+ }, 0);
37
+ },
38
+ [form],
39
+ );
40
+
41
+ return (
42
+ <Form.List name="query">
43
+ {(fields, { add, remove }) => (
44
+ <>
45
+ {fields.map(({ key, name, ...restField }) => (
46
+ <Flex key={key} gap={10} align={'baseline'}>
47
+ <Form.Item
48
+ {...restField}
49
+ name={[name, 'type']}
50
+ className={styles.variableType}
51
+ >
52
+ <Select
53
+ options={options}
54
+ onChange={handleTypeChange(name)}
55
+ ></Select>
56
+ </Form.Item>
57
+ <Form.Item noStyle dependencies={[name, 'type']}>
58
+ {({ getFieldValue }) => {
59
+ const type = getFieldValue(['query', name, 'type']);
60
+ return (
61
+ <Form.Item
62
+ {...restField}
63
+ name={[name, getVariableName(type)]}
64
+ className={styles.variableValue}
65
+ >
66
+ {type === VariableType.Reference ? (
67
+ <Select
68
+ placeholder={t('common.pleaseSelect')}
69
+ options={valueOptions}
70
+ ></Select>
71
+ ) : (
72
+ <Input placeholder={t('common.pleaseInput')} />
73
+ )}
74
+ </Form.Item>
75
+ );
76
+ }}
77
+ </Form.Item>
78
+ <MinusCircleOutlined onClick={() => remove(name)} />
79
+ </Flex>
80
+ ))}
81
+ <Form.Item>
82
+ <Button
83
+ type="dashed"
84
+ onClick={() => add({ type: VariableType.Reference })}
85
+ block
86
+ icon={<PlusOutlined />}
87
+ className={styles.addButton}
88
+ >
89
+ {t('flow.addItem')}
90
+ </Button>
91
+ </Form.Item>
92
+ </>
93
+ )}
94
+ </Form.List>
95
+ );
96
+ };
97
+
98
+ const DynamicInputVariable = ({ nodeId }: IProps) => {
99
+ const { t } = useTranslation();
100
+
101
+ return (
102
+ <Collapse
103
+ className={styles.dynamicInputVariable}
104
+ defaultActiveKey={['1']}
105
+ items={[
106
+ {
107
+ key: '1',
108
+ label: <span className={styles.title}>{t('flow.input')}</span>,
109
+ children: <DynamicVariableForm nodeId={nodeId}></DynamicVariableForm>,
110
+ },
111
+ ]}
112
+ />
113
+ );
114
+ };
115
+
116
+ export default DynamicInputVariable;
web/src/pages/flow/form/components/index.less ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .dynamicInputVariable {
2
+ background-color: #ebe9e9;
3
+ :global(.ant-collapse-content) {
4
+ background-color: #f6f6f6;
5
+ }
6
+ margin-bottom: 20px;
7
+ .title {
8
+ font-weight: 600;
9
+ font-size: 16px;
10
+ }
11
+ .variableType {
12
+ width: 30%;
13
+ }
14
+ .variableValue {
15
+ flex: 1;
16
+ }
17
+
18
+ .addButton {
19
+ color: rgb(22, 119, 255);
20
+ font-weight: 600;
21
+ }
22
+ }
web/src/pages/flow/form/crawler-form/index.tsx CHANGED
@@ -3,7 +3,8 @@ import { Form, Input, Select } from 'antd';
3
  import { useMemo } from 'react';
4
  import { CrawlerResultOptions } from '../../constant';
5
  import { IOperatorForm } from '../../interface';
6
- const CrawlerForm = ({ onValuesChange, form }: IOperatorForm) => {
 
7
  const { t } = useTranslate('flow');
8
  const crawlerResultOptions = useMemo(() => {
9
  return CrawlerResultOptions.map((x) => ({
@@ -14,12 +15,12 @@ const CrawlerForm = ({ onValuesChange, form }: IOperatorForm) => {
14
  return (
15
  <Form
16
  name="basic"
17
- labelCol={{ span: 6 }}
18
- wrapperCol={{ span: 18 }}
19
  autoComplete="off"
20
  form={form}
21
  onValuesChange={onValuesChange}
 
22
  >
 
23
  <Form.Item label={t('proxy')} name={'proxy'}>
24
  <Input placeholder="like: http://127.0.0.1:8888"></Input>
25
  </Form.Item>
 
3
  import { useMemo } from 'react';
4
  import { CrawlerResultOptions } from '../../constant';
5
  import { IOperatorForm } from '../../interface';
6
+ import DynamicInputVariable from '../components/dynamic-input-variable';
7
+ const CrawlerForm = ({ onValuesChange, form, node }: IOperatorForm) => {
8
  const { t } = useTranslate('flow');
9
  const crawlerResultOptions = useMemo(() => {
10
  return CrawlerResultOptions.map((x) => ({
 
15
  return (
16
  <Form
17
  name="basic"
 
 
18
  autoComplete="off"
19
  form={form}
20
  onValuesChange={onValuesChange}
21
+ layout={'vertical'}
22
  >
23
+ <DynamicInputVariable nodeId={node?.id}></DynamicInputVariable>
24
  <Form.Item label={t('proxy')} name={'proxy'}>
25
  <Input placeholder="like: http://127.0.0.1:8888"></Input>
26
  </Form.Item>
web/src/pages/flow/form/deepl-form/index.tsx CHANGED
@@ -4,20 +4,21 @@ import { Form, Select } from 'antd';
4
  import { DeepLSourceLangOptions, DeepLTargetLangOptions } from '../../constant';
5
  import { useBuildSortOptions } from '../../form-hooks';
6
  import { IOperatorForm } from '../../interface';
 
7
 
8
- const DeepLForm = ({ onValuesChange, form }: IOperatorForm) => {
9
  const { t } = useTranslate('flow');
10
  const options = useBuildSortOptions();
11
 
12
  return (
13
  <Form
14
  name="basic"
15
- labelCol={{ span: 8 }}
16
- wrapperCol={{ span: 16 }}
17
  autoComplete="off"
18
  form={form}
19
  onValuesChange={onValuesChange}
 
20
  >
 
21
  <TopNItem initialValue={5}></TopNItem>
22
  <Form.Item label={t('authKey')} name={'auth_key'}>
23
  <Select options={options}></Select>
 
4
  import { DeepLSourceLangOptions, DeepLTargetLangOptions } from '../../constant';
5
  import { useBuildSortOptions } from '../../form-hooks';
6
  import { IOperatorForm } from '../../interface';
7
+ import DynamicInputVariable from '../components/dynamic-input-variable';
8
 
9
+ const DeepLForm = ({ onValuesChange, form, node }: IOperatorForm) => {
10
  const { t } = useTranslate('flow');
11
  const options = useBuildSortOptions();
12
 
13
  return (
14
  <Form
15
  name="basic"
 
 
16
  autoComplete="off"
17
  form={form}
18
  onValuesChange={onValuesChange}
19
+ layout={'vertical'}
20
  >
21
+ <DynamicInputVariable nodeId={node?.id}></DynamicInputVariable>
22
  <TopNItem initialValue={5}></TopNItem>
23
  <Form.Item label={t('authKey')} name={'auth_key'}>
24
  <Select options={options}></Select>
web/src/pages/flow/form/duckduckgo-form/index.tsx CHANGED
@@ -4,8 +4,9 @@ import { Form, Select } from 'antd';
4
  import { useMemo } from 'react';
5
  import { Channel } from '../../constant';
6
  import { IOperatorForm } from '../../interface';
 
7
 
8
- const DuckDuckGoForm = ({ onValuesChange, form }: IOperatorForm) => {
9
  const { t } = useTranslate('flow');
10
 
11
  const options = useMemo(() => {
@@ -15,12 +16,12 @@ const DuckDuckGoForm = ({ onValuesChange, form }: IOperatorForm) => {
15
  return (
16
  <Form
17
  name="basic"
18
- labelCol={{ span: 6 }}
19
- wrapperCol={{ span: 18 }}
20
  autoComplete="off"
21
  form={form}
22
  onValuesChange={onValuesChange}
 
23
  >
 
24
  <TopNItem initialValue={10}></TopNItem>
25
  <Form.Item
26
  label={t('channel')}
 
4
  import { useMemo } from 'react';
5
  import { Channel } from '../../constant';
6
  import { IOperatorForm } from '../../interface';
7
+ import DynamicInputVariable from '../components/dynamic-input-variable';
8
 
9
+ const DuckDuckGoForm = ({ onValuesChange, form, node }: IOperatorForm) => {
10
  const { t } = useTranslate('flow');
11
 
12
  const options = useMemo(() => {
 
16
  return (
17
  <Form
18
  name="basic"
 
 
19
  autoComplete="off"
20
  form={form}
21
  onValuesChange={onValuesChange}
22
+ layout={'vertical'}
23
  >
24
+ <DynamicInputVariable nodeId={node?.id}></DynamicInputVariable>
25
  <TopNItem initialValue={10}></TopNItem>
26
  <Form.Item
27
  label={t('channel')}
web/src/pages/flow/form/exesql-form/index.tsx CHANGED
@@ -5,8 +5,9 @@ import { Button, Flex, Form, Input, InputNumber, Select } from 'antd';
5
  import { useCallback } from 'react';
6
  import { ExeSQLOptions } from '../../constant';
7
  import { IOperatorForm } from '../../interface';
 
8
 
9
- const ExeSQLForm = ({ onValuesChange, form }: IOperatorForm) => {
10
  const { t } = useTranslate('flow');
11
  const { testDbConnect, loading } = useTestDbConnect();
12
 
@@ -18,12 +19,12 @@ const ExeSQLForm = ({ onValuesChange, form }: IOperatorForm) => {
18
  return (
19
  <Form
20
  name="basic"
21
- labelCol={{ span: 7 }}
22
- wrapperCol={{ span: 17 }}
23
  autoComplete="off"
24
  form={form}
25
  onValuesChange={onValuesChange}
 
26
  >
 
27
  <Form.Item
28
  label={t('dbType')}
29
  name={'db_type'}
 
5
  import { useCallback } from 'react';
6
  import { ExeSQLOptions } from '../../constant';
7
  import { IOperatorForm } from '../../interface';
8
+ import DynamicInputVariable from '../components/dynamic-input-variable';
9
 
10
+ const ExeSQLForm = ({ onValuesChange, form, node }: IOperatorForm) => {
11
  const { t } = useTranslate('flow');
12
  const { testDbConnect, loading } = useTestDbConnect();
13
 
 
19
  return (
20
  <Form
21
  name="basic"
 
 
22
  autoComplete="off"
23
  form={form}
24
  onValuesChange={onValuesChange}
25
+ layout={'vertical'}
26
  >
27
+ <DynamicInputVariable nodeId={node?.id}></DynamicInputVariable>
28
  <Form.Item
29
  label={t('dbType')}
30
  name={'db_type'}
web/src/pages/flow/form/github-form/index.tsx CHANGED
@@ -1,17 +1,18 @@
1
  import TopNItem from '@/components/top-n-item';
2
  import { Form } from 'antd';
3
  import { IOperatorForm } from '../../interface';
 
4
 
5
- const GithubForm = ({ onValuesChange, form }: IOperatorForm) => {
6
  return (
7
  <Form
8
  name="basic"
9
- labelCol={{ span: 6 }}
10
- wrapperCol={{ span: 18 }}
11
  autoComplete="off"
12
  form={form}
13
  onValuesChange={onValuesChange}
 
14
  >
 
15
  <TopNItem initialValue={5}></TopNItem>
16
  </Form>
17
  );
 
1
  import TopNItem from '@/components/top-n-item';
2
  import { Form } from 'antd';
3
  import { IOperatorForm } from '../../interface';
4
+ import DynamicInputVariable from '../components/dynamic-input-variable';
5
 
6
+ const GithubForm = ({ onValuesChange, form, node }: IOperatorForm) => {
7
  return (
8
  <Form
9
  name="basic"
 
 
10
  autoComplete="off"
11
  form={form}
12
  onValuesChange={onValuesChange}
13
+ layout={'vertical'}
14
  >
15
+ <DynamicInputVariable nodeId={node?.id}></DynamicInputVariable>
16
  <TopNItem initialValue={5}></TopNItem>
17
  </Form>
18
  );
web/src/pages/flow/form/google-form/index.tsx CHANGED
@@ -3,19 +3,20 @@ import { useTranslate } from '@/hooks/common-hooks';
3
  import { Form, Input, Select } from 'antd';
4
  import { GoogleCountryOptions, GoogleLanguageOptions } from '../../constant';
5
  import { IOperatorForm } from '../../interface';
 
6
 
7
- const GoogleForm = ({ onValuesChange, form }: IOperatorForm) => {
8
  const { t } = useTranslate('flow');
9
 
10
  return (
11
  <Form
12
  name="basic"
13
- labelCol={{ span: 6 }}
14
- wrapperCol={{ span: 18 }}
15
  autoComplete="off"
16
  form={form}
17
  onValuesChange={onValuesChange}
 
18
  >
 
19
  <TopNItem initialValue={10}></TopNItem>
20
  <Form.Item label={t('apiKey')} name={'api_key'}>
21
  <Input></Input>
 
3
  import { Form, Input, Select } from 'antd';
4
  import { GoogleCountryOptions, GoogleLanguageOptions } from '../../constant';
5
  import { IOperatorForm } from '../../interface';
6
+ import DynamicInputVariable from '../components/dynamic-input-variable';
7
 
8
+ const GoogleForm = ({ onValuesChange, form, node }: IOperatorForm) => {
9
  const { t } = useTranslate('flow');
10
 
11
  return (
12
  <Form
13
  name="basic"
 
 
14
  autoComplete="off"
15
  form={form}
16
  onValuesChange={onValuesChange}
17
+ layout={'vertical'}
18
  >
19
+ <DynamicInputVariable nodeId={node?.id}></DynamicInputVariable>
20
  <TopNItem initialValue={10}></TopNItem>
21
  <Form.Item label={t('apiKey')} name={'api_key'}>
22
  <Input></Input>
web/src/pages/flow/form/google-scholar-form/index.tsx CHANGED
@@ -5,6 +5,7 @@ import dayjs from 'dayjs';
5
  import { useCallback, useMemo } from 'react';
6
  import { useBuildSortOptions } from '../../form-hooks';
7
  import { IOperatorForm } from '../../interface';
 
8
 
9
  const YearPicker = ({
10
  onChange,
@@ -31,7 +32,7 @@ const YearPicker = ({
31
  return <DatePicker picker="year" onChange={handleChange} value={nextValue} />;
32
  };
33
 
34
- const GoogleScholarForm = ({ onValuesChange, form }: IOperatorForm) => {
35
  const { t } = useTranslate('flow');
36
 
37
  const options = useBuildSortOptions();
@@ -39,12 +40,12 @@ const GoogleScholarForm = ({ onValuesChange, form }: IOperatorForm) => {
39
  return (
40
  <Form
41
  name="basic"
42
- labelCol={{ span: 6 }}
43
- wrapperCol={{ span: 18 }}
44
  autoComplete="off"
45
  form={form}
46
  onValuesChange={onValuesChange}
 
47
  >
 
48
  <TopNItem initialValue={5}></TopNItem>
49
  <Form.Item
50
  label={t('sortBy')}
 
5
  import { useCallback, useMemo } from 'react';
6
  import { useBuildSortOptions } from '../../form-hooks';
7
  import { IOperatorForm } from '../../interface';
8
+ import DynamicInputVariable from '../components/dynamic-input-variable';
9
 
10
  const YearPicker = ({
11
  onChange,
 
32
  return <DatePicker picker="year" onChange={handleChange} value={nextValue} />;
33
  };
34
 
35
+ const GoogleScholarForm = ({ onValuesChange, form, node }: IOperatorForm) => {
36
  const { t } = useTranslate('flow');
37
 
38
  const options = useBuildSortOptions();
 
40
  return (
41
  <Form
42
  name="basic"
 
 
43
  autoComplete="off"
44
  form={form}
45
  onValuesChange={onValuesChange}
46
+ layout={'vertical'}
47
  >
48
+ <DynamicInputVariable nodeId={node?.id}></DynamicInputVariable>
49
  <TopNItem initialValue={5}></TopNItem>
50
  <Form.Item
51
  label={t('sortBy')}
web/src/pages/flow/form/jin10-form/index.tsx CHANGED
@@ -10,8 +10,9 @@ import {
10
  Jin10TypeOptions,
11
  } from '../../constant';
12
  import { IOperatorForm } from '../../interface';
 
13
 
14
- const Jin10Form = ({ onValuesChange, form }: IOperatorForm) => {
15
  const { t } = useTranslate('flow');
16
 
17
  const jin10TypeOptions = useMemo(() => {
@@ -59,12 +60,12 @@ const Jin10Form = ({ onValuesChange, form }: IOperatorForm) => {
59
  return (
60
  <Form
61
  name="basic"
62
- labelCol={{ span: 9 }}
63
- wrapperCol={{ span: 15 }}
64
  autoComplete="off"
65
  form={form}
66
  onValuesChange={onValuesChange}
 
67
  >
 
68
  <Form.Item label={t('type')} name={'type'} initialValue={'flash'}>
69
  <Select options={jin10TypeOptions}></Select>
70
  </Form.Item>
 
10
  Jin10TypeOptions,
11
  } from '../../constant';
12
  import { IOperatorForm } from '../../interface';
13
+ import DynamicInputVariable from '../components/dynamic-input-variable';
14
 
15
+ const Jin10Form = ({ onValuesChange, form, node }: IOperatorForm) => {
16
  const { t } = useTranslate('flow');
17
 
18
  const jin10TypeOptions = useMemo(() => {
 
60
  return (
61
  <Form
62
  name="basic"
 
 
63
  autoComplete="off"
64
  form={form}
65
  onValuesChange={onValuesChange}
66
+ layout={'vertical'}
67
  >
68
+ <DynamicInputVariable nodeId={node?.id}></DynamicInputVariable>
69
  <Form.Item label={t('type')} name={'type'} initialValue={'flash'}>
70
  <Select options={jin10TypeOptions}></Select>
71
  </Form.Item>
web/src/pages/flow/form/keyword-extract-form/index.tsx CHANGED
@@ -4,8 +4,9 @@ import { useTranslate } from '@/hooks/common-hooks';
4
  import { Form } from 'antd';
5
  import { useSetLlmSetting } from '../../hooks';
6
  import { IOperatorForm } from '../../interface';
 
7
 
8
- const KeywordExtractForm = ({ onValuesChange, form }: IOperatorForm) => {
9
  const { t } = useTranslate('flow');
10
 
11
  useSetLlmSetting(form);
@@ -13,12 +14,12 @@ const KeywordExtractForm = ({ onValuesChange, form }: IOperatorForm) => {
13
  return (
14
  <Form
15
  name="basic"
16
- labelCol={{ span: 6 }}
17
- wrapperCol={{ span: 18 }}
18
  autoComplete="off"
19
  form={form}
20
  onValuesChange={onValuesChange}
 
21
  >
 
22
  <Form.Item
23
  name={'llm_id'}
24
  label={t('model', { keyPrefix: 'chat' })}
 
4
  import { Form } from 'antd';
5
  import { useSetLlmSetting } from '../../hooks';
6
  import { IOperatorForm } from '../../interface';
7
+ import DynamicInputVariable from '../components/dynamic-input-variable';
8
 
9
+ const KeywordExtractForm = ({ onValuesChange, form, node }: IOperatorForm) => {
10
  const { t } = useTranslate('flow');
11
 
12
  useSetLlmSetting(form);
 
14
  return (
15
  <Form
16
  name="basic"
 
 
17
  autoComplete="off"
18
  form={form}
19
  onValuesChange={onValuesChange}
20
+ layout={'vertical'}
21
  >
22
+ <DynamicInputVariable nodeId={node?.id}></DynamicInputVariable>
23
  <Form.Item
24
  name={'llm_id'}
25
  label={t('model', { keyPrefix: 'chat' })}
web/src/pages/flow/form/pubmed-form/index.tsx CHANGED
@@ -2,19 +2,20 @@ import TopNItem from '@/components/top-n-item';
2
  import { useTranslate } from '@/hooks/common-hooks';
3
  import { Form, Input } from 'antd';
4
  import { IOperatorForm } from '../../interface';
 
5
 
6
- const PubMedForm = ({ onValuesChange, form }: IOperatorForm) => {
7
  const { t } = useTranslate('flow');
8
 
9
  return (
10
  <Form
11
  name="basic"
12
- labelCol={{ span: 6 }}
13
- wrapperCol={{ span: 18 }}
14
  autoComplete="off"
15
  form={form}
16
  onValuesChange={onValuesChange}
 
17
  >
 
18
  <TopNItem initialValue={10}></TopNItem>
19
  <Form.Item
20
  label={t('email')}
 
2
  import { useTranslate } from '@/hooks/common-hooks';
3
  import { Form, Input } from 'antd';
4
  import { IOperatorForm } from '../../interface';
5
+ import DynamicInputVariable from '../components/dynamic-input-variable';
6
 
7
+ const PubMedForm = ({ onValuesChange, form, node }: IOperatorForm) => {
8
  const { t } = useTranslate('flow');
9
 
10
  return (
11
  <Form
12
  name="basic"
 
 
13
  autoComplete="off"
14
  form={form}
15
  onValuesChange={onValuesChange}
16
+ layout={'vertical'}
17
  >
18
+ <DynamicInputVariable nodeId={node?.id}></DynamicInputVariable>
19
  <TopNItem initialValue={10}></TopNItem>
20
  <Form.Item
21
  label={t('email')}
web/src/pages/flow/form/qweather-form/index.tsx CHANGED
@@ -8,8 +8,9 @@ import {
8
  QWeatherUserTypeOptions,
9
  } from '../../constant';
10
  import { IOperatorForm } from '../../interface';
 
11
 
12
- const QWeatherForm = ({ onValuesChange, form }: IOperatorForm) => {
13
  const { t } = useTranslate('flow');
14
  const qWeatherLangOptions = useMemo(() => {
15
  return QWeatherLangOptions.map((x) => ({
@@ -49,12 +50,12 @@ const QWeatherForm = ({ onValuesChange, form }: IOperatorForm) => {
49
  return (
50
  <Form
51
  name="basic"
52
- labelCol={{ span: 6 }}
53
- wrapperCol={{ span: 18 }}
54
  autoComplete="off"
55
  form={form}
56
  onValuesChange={onValuesChange}
 
57
  >
 
58
  <Form.Item label={t('webApiKey')} name={'web_apikey'}>
59
  <Input></Input>
60
  </Form.Item>
 
8
  QWeatherUserTypeOptions,
9
  } from '../../constant';
10
  import { IOperatorForm } from '../../interface';
11
+ import DynamicInputVariable from '../components/dynamic-input-variable';
12
 
13
+ const QWeatherForm = ({ onValuesChange, form, node }: IOperatorForm) => {
14
  const { t } = useTranslate('flow');
15
  const qWeatherLangOptions = useMemo(() => {
16
  return QWeatherLangOptions.map((x) => ({
 
50
  return (
51
  <Form
52
  name="basic"
 
 
53
  autoComplete="off"
54
  form={form}
55
  onValuesChange={onValuesChange}
56
+ layout={'vertical'}
57
  >
58
+ <DynamicInputVariable nodeId={node?.id}></DynamicInputVariable>
59
  <Form.Item label={t('webApiKey')} name={'web_apikey'}>
60
  <Input></Input>
61
  </Form.Item>
web/src/pages/flow/form/retrieval-form/index.tsx CHANGED
@@ -6,6 +6,7 @@ import { useTranslate } from '@/hooks/common-hooks';
6
  import type { FormProps } from 'antd';
7
  import { Form, Input } from 'antd';
8
  import { IOperatorForm } from '../../interface';
 
9
 
10
  type FieldType = {
11
  top_n?: number;
@@ -19,7 +20,7 @@ const onFinishFailed: FormProps<FieldType>['onFinishFailed'] = (errorInfo) => {
19
  console.log('Failed:', errorInfo);
20
  };
21
 
22
- const RetrievalForm = ({ onValuesChange, form }: IOperatorForm) => {
23
  const { t } = useTranslate('flow');
24
  return (
25
  <Form
@@ -31,6 +32,7 @@ const RetrievalForm = ({ onValuesChange, form }: IOperatorForm) => {
31
  form={form}
32
  layout={'vertical'}
33
  >
 
34
  <SimilaritySlider
35
  isTooltipShown
36
  vectorSimilarityWeightName="keywords_similarity_weight"
 
6
  import type { FormProps } from 'antd';
7
  import { Form, Input } from 'antd';
8
  import { IOperatorForm } from '../../interface';
9
+ import DynamicInputVariable from '../components/dynamic-input-variable';
10
 
11
  type FieldType = {
12
  top_n?: number;
 
20
  console.log('Failed:', errorInfo);
21
  };
22
 
23
+ const RetrievalForm = ({ onValuesChange, form, node }: IOperatorForm) => {
24
  const { t } = useTranslate('flow');
25
  return (
26
  <Form
 
32
  form={form}
33
  layout={'vertical'}
34
  >
35
+ <DynamicInputVariable nodeId={node?.id}></DynamicInputVariable>
36
  <SimilaritySlider
37
  isTooltipShown
38
  vectorSimilarityWeightName="keywords_similarity_weight"
web/src/pages/flow/form/tushare-form/index.tsx CHANGED
@@ -4,6 +4,7 @@ import dayjs from 'dayjs';
4
  import { useCallback, useMemo } from 'react';
5
  import { TuShareSrcOptions } from '../../constant';
6
  import { IOperatorForm } from '../../interface';
 
7
 
8
  const DateTimePicker = ({
9
  onChange,
@@ -37,7 +38,7 @@ const DateTimePicker = ({
37
  );
38
  };
39
 
40
- const TuShareForm = ({ onValuesChange, form }: IOperatorForm) => {
41
  const { t } = useTranslate('flow');
42
 
43
  const tuShareSrcOptions = useMemo(() => {
@@ -50,12 +51,12 @@ const TuShareForm = ({ onValuesChange, form }: IOperatorForm) => {
50
  return (
51
  <Form
52
  name="basic"
53
- labelCol={{ span: 6 }}
54
- wrapperCol={{ span: 18 }}
55
  autoComplete="off"
56
  form={form}
57
  onValuesChange={onValuesChange}
 
58
  >
 
59
  <Form.Item
60
  label={t('token')}
61
  name={'token'}
 
4
  import { useCallback, useMemo } from 'react';
5
  import { TuShareSrcOptions } from '../../constant';
6
  import { IOperatorForm } from '../../interface';
7
+ import DynamicInputVariable from '../components/dynamic-input-variable';
8
 
9
  const DateTimePicker = ({
10
  onChange,
 
38
  );
39
  };
40
 
41
+ const TuShareForm = ({ onValuesChange, form, node }: IOperatorForm) => {
42
  const { t } = useTranslate('flow');
43
 
44
  const tuShareSrcOptions = useMemo(() => {
 
51
  return (
52
  <Form
53
  name="basic"
 
 
54
  autoComplete="off"
55
  form={form}
56
  onValuesChange={onValuesChange}
57
+ layout={'vertical'}
58
  >
59
+ <DynamicInputVariable nodeId={node?.id}></DynamicInputVariable>
60
  <Form.Item
61
  label={t('token')}
62
  name={'token'}
web/src/pages/flow/form/wencai-form/index.tsx CHANGED
@@ -4,8 +4,9 @@ import { Form, Select } from 'antd';
4
  import { useMemo } from 'react';
5
  import { WenCaiQueryTypeOptions } from '../../constant';
6
  import { IOperatorForm } from '../../interface';
 
7
 
8
- const WenCaiForm = ({ onValuesChange, form }: IOperatorForm) => {
9
  const { t } = useTranslate('flow');
10
 
11
  const wenCaiQueryTypeOptions = useMemo(() => {
@@ -18,12 +19,12 @@ const WenCaiForm = ({ onValuesChange, form }: IOperatorForm) => {
18
  return (
19
  <Form
20
  name="basic"
21
- labelCol={{ span: 6 }}
22
- wrapperCol={{ span: 18 }}
23
  autoComplete="off"
24
  form={form}
25
  onValuesChange={onValuesChange}
 
26
  >
 
27
  <TopNItem initialValue={20} max={99}></TopNItem>
28
  <Form.Item label={t('queryType')} name={'query_type'}>
29
  <Select options={wenCaiQueryTypeOptions}></Select>
 
4
  import { useMemo } from 'react';
5
  import { WenCaiQueryTypeOptions } from '../../constant';
6
  import { IOperatorForm } from '../../interface';
7
+ import DynamicInputVariable from '../components/dynamic-input-variable';
8
 
9
+ const WenCaiForm = ({ onValuesChange, form, node }: IOperatorForm) => {
10
  const { t } = useTranslate('flow');
11
 
12
  const wenCaiQueryTypeOptions = useMemo(() => {
 
19
  return (
20
  <Form
21
  name="basic"
 
 
22
  autoComplete="off"
23
  form={form}
24
  onValuesChange={onValuesChange}
25
+ layout={'vertical'}
26
  >
27
+ <DynamicInputVariable nodeId={node?.id}></DynamicInputVariable>
28
  <TopNItem initialValue={20} max={99}></TopNItem>
29
  <Form.Item label={t('queryType')} name={'query_type'}>
30
  <Select options={wenCaiQueryTypeOptions}></Select>
web/src/pages/flow/form/wikipedia-form/index.tsx CHANGED
@@ -3,19 +3,20 @@ import { useTranslate } from '@/hooks/common-hooks';
3
  import { Form, Select } from 'antd';
4
  import { LanguageOptions } from '../../constant';
5
  import { IOperatorForm } from '../../interface';
 
6
 
7
- const WikipediaForm = ({ onValuesChange, form }: IOperatorForm) => {
8
  const { t } = useTranslate('common');
9
 
10
  return (
11
  <Form
12
  name="basic"
13
- labelCol={{ span: 6 }}
14
- wrapperCol={{ span: 18 }}
15
  autoComplete="off"
16
  form={form}
17
  onValuesChange={onValuesChange}
 
18
  >
 
19
  <TopNItem initialValue={10}></TopNItem>
20
  <Form.Item label={t('language')} name={'language'}>
21
  <Select options={LanguageOptions}></Select>
 
3
  import { Form, Select } from 'antd';
4
  import { LanguageOptions } from '../../constant';
5
  import { IOperatorForm } from '../../interface';
6
+ import DynamicInputVariable from '../components/dynamic-input-variable';
7
 
8
+ const WikipediaForm = ({ onValuesChange, form, node }: IOperatorForm) => {
9
  const { t } = useTranslate('common');
10
 
11
  return (
12
  <Form
13
  name="basic"
 
 
14
  autoComplete="off"
15
  form={form}
16
  onValuesChange={onValuesChange}
17
+ layout={'vertical'}
18
  >
19
+ <DynamicInputVariable nodeId={node?.id}></DynamicInputVariable>
20
  <TopNItem initialValue={10}></TopNItem>
21
  <Form.Item label={t('language')} name={'language'}>
22
  <Select options={LanguageOptions}></Select>
web/src/pages/flow/form/yahoo-finance-form/index.tsx CHANGED
@@ -1,19 +1,20 @@
1
  import { useTranslate } from '@/hooks/common-hooks';
2
  import { Form, Switch } from 'antd';
3
  import { IOperatorForm } from '../../interface';
 
4
 
5
- const YahooFinanceForm = ({ onValuesChange, form }: IOperatorForm) => {
6
  const { t } = useTranslate('flow');
7
 
8
  return (
9
  <Form
10
  name="basic"
11
- labelCol={{ span: 10 }}
12
- wrapperCol={{ span: 14 }}
13
  autoComplete="off"
14
  form={form}
15
  onValuesChange={onValuesChange}
 
16
  >
 
17
  <Form.Item label={t('info')} name={'info'}>
18
  <Switch></Switch>
19
  </Form.Item>
 
1
  import { useTranslate } from '@/hooks/common-hooks';
2
  import { Form, Switch } from 'antd';
3
  import { IOperatorForm } from '../../interface';
4
+ import DynamicInputVariable from '../components/dynamic-input-variable';
5
 
6
+ const YahooFinanceForm = ({ onValuesChange, form, node }: IOperatorForm) => {
7
  const { t } = useTranslate('flow');
8
 
9
  return (
10
  <Form
11
  name="basic"
 
 
12
  autoComplete="off"
13
  form={form}
14
  onValuesChange={onValuesChange}
15
+ layout={'vertical'}
16
  >
17
+ <DynamicInputVariable nodeId={node?.id}></DynamicInputVariable>
18
  <Form.Item label={t('info')} name={'info'}>
19
  <Switch></Switch>
20
  </Form.Item>