balibabu commited on
Commit
5000eb5
·
1 Parent(s): 70aabf0

feat: Add component Concentrator #1739 (#2604)

Browse files

### What problem does this PR solve?

feat: Add component Concentrator #1739
### Type of change

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

web/src/assets/svg/concentrator.svg ADDED
web/src/locales/en.ts CHANGED
@@ -682,7 +682,7 @@ The above is the content you need to summarize.`,
682
  createFromTemplates: 'Create from templates',
683
  retrieval: 'Retrieval',
684
  generate: 'Generate',
685
- answer: 'Answer',
686
  categorize: 'Categorize',
687
  relevant: 'Relevant',
688
  rewriteQuestion: 'Rewrite',
@@ -964,6 +964,9 @@ The above is the content you need to summarize.`,
964
  symbols: 'Commodity List',
965
  quotes: ' Latest Market Quotes',
966
  },
 
 
 
967
  },
968
  footer: {
969
  profile: 'All rights reserved @ React',
 
682
  createFromTemplates: 'Create from templates',
683
  retrieval: 'Retrieval',
684
  generate: 'Generate',
685
+ answer: 'Interact',
686
  categorize: 'Categorize',
687
  relevant: 'Relevant',
688
  rewriteQuestion: 'Rewrite',
 
964
  symbols: 'Commodity List',
965
  quotes: ' Latest Market Quotes',
966
  },
967
+ concentrator: 'Concentrator',
968
+ concentratorDescription:
969
+ 'This component can be used to connect multiple downstream components. It receives input from the upstream component and passes it to each downstream component.',
970
  },
971
  footer: {
972
  profile: 'All rights reserved @ React',
web/src/locales/zh-traditional.ts CHANGED
@@ -916,6 +916,9 @@ export default {
916
  symbols: '品種列表',
917
  quotes: '最新行情',
918
  },
 
 
 
919
  },
920
  footer: {
921
  profile: '“保留所有權利 @ react”',
 
916
  symbols: '品種列表',
917
  quotes: '最新行情',
918
  },
919
+ concentrator: '集線器',
920
+ concentratorDescription:
921
+ '此組件可用於連接多個下游組件。它接收來自上游組件的輸入並將其傳遞給每個下游組件。 ',
922
  },
923
  footer: {
924
  profile: '“保留所有權利 @ react”',
web/src/locales/zh.ts CHANGED
@@ -934,6 +934,9 @@ export default {
934
  symbols: '品种列表',
935
  quotes: '最新行情',
936
  },
 
 
 
937
  },
938
  footer: {
939
  profile: 'All rights reserved @ React',
 
934
  symbols: '品种列表',
935
  quotes: '最新行情',
936
  },
937
+ concentrator: '集线器',
938
+ concentratorDescription:
939
+ '该组件可用于连接多个下游组件。它接收来自上游组件的输入并将其传递给每个下游组件。',
940
  },
941
  footer: {
942
  profile: 'All rights reserved @ React',
web/src/pages/flow/concentrator-form/index.tsx ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { Form } from 'antd';
2
+ import { IOperatorForm } from '../interface';
3
+
4
+ const ConcentratorForm = ({ onValuesChange, form }: IOperatorForm) => {
5
+ return (
6
+ <Form
7
+ name="basic"
8
+ labelCol={{ span: 8 }}
9
+ wrapperCol={{ span: 16 }}
10
+ autoComplete="off"
11
+ form={form}
12
+ onValuesChange={onValuesChange}
13
+ ></Form>
14
+ );
15
+ };
16
+
17
+ export default ConcentratorForm;
web/src/pages/flow/constant.tsx CHANGED
@@ -3,6 +3,7 @@ import { ReactComponent as ArXivIcon } from '@/assets/svg/arxiv.svg';
3
  import { ReactComponent as baiduFanyiIcon } from '@/assets/svg/baidu-fanyi.svg';
4
  import { ReactComponent as BaiduIcon } from '@/assets/svg/baidu.svg';
5
  import { ReactComponent as BingIcon } from '@/assets/svg/bing.svg';
 
6
  import { ReactComponent as DeepLIcon } from '@/assets/svg/deepl.svg';
7
  import { ReactComponent as DuckIcon } from '@/assets/svg/duck.svg';
8
  import { ReactComponent as ExeSqlIcon } from '@/assets/svg/exesql.svg';
@@ -67,6 +68,7 @@ export enum Operator {
67
  AkShare = 'AkShare',
68
  YahooFinance = 'YahooFinance',
69
  Jin10 = 'Jin10',
 
70
  }
71
 
72
  export const operatorIconMap = {
@@ -97,6 +99,7 @@ export const operatorIconMap = {
97
  [Operator.AkShare]: AkShareIcon,
98
  [Operator.YahooFinance]: YahooFinanceIcon,
99
  [Operator.Jin10]: Jin10Icon,
 
100
  };
101
 
102
  export const operatorMap: Record<
@@ -210,6 +213,14 @@ export const operatorMap: Record<
210
  [Operator.AkShare]: { backgroundColor: '#8085f5' },
211
  [Operator.YahooFinance]: { backgroundColor: '#b474ff' },
212
  [Operator.Jin10]: { backgroundColor: '#a0b9f8' },
 
 
 
 
 
 
 
 
213
  };
214
 
215
  export const componentMenuList = [
@@ -240,6 +251,9 @@ export const componentMenuList = [
240
  {
241
  name: Operator.Switch,
242
  },
 
 
 
243
  {
244
  name: Operator.DuckDuckGo,
245
  },
@@ -451,6 +465,8 @@ export const initialJin10Values = {
451
  filter: '',
452
  };
453
 
 
 
454
  export const CategorizeAnchorPointPositions = [
455
  { top: 1, right: 34 },
456
  { top: 8, right: 18 },
@@ -525,6 +541,7 @@ export const RestrictedUpstreamMap = {
525
  [Operator.AkShare]: [Operator.Begin],
526
  [Operator.YahooFinance]: [Operator.Begin],
527
  [Operator.Jin10]: [Operator.Begin],
 
528
  };
529
 
530
  export const NodeMap = {
@@ -551,6 +568,7 @@ export const NodeMap = {
551
  [Operator.QWeather]: 'ragNode',
552
  [Operator.ExeSQL]: 'ragNode',
553
  [Operator.Switch]: 'categorizeNode',
 
554
  [Operator.WenCai]: 'ragNode',
555
  [Operator.AkShare]: 'ragNode',
556
  [Operator.YahooFinance]: 'ragNode',
 
3
  import { ReactComponent as baiduFanyiIcon } from '@/assets/svg/baidu-fanyi.svg';
4
  import { ReactComponent as BaiduIcon } from '@/assets/svg/baidu.svg';
5
  import { ReactComponent as BingIcon } from '@/assets/svg/bing.svg';
6
+ import { ReactComponent as ConcentratorIcon } from '@/assets/svg/concentrator.svg';
7
  import { ReactComponent as DeepLIcon } from '@/assets/svg/deepl.svg';
8
  import { ReactComponent as DuckIcon } from '@/assets/svg/duck.svg';
9
  import { ReactComponent as ExeSqlIcon } from '@/assets/svg/exesql.svg';
 
68
  AkShare = 'AkShare',
69
  YahooFinance = 'YahooFinance',
70
  Jin10 = 'Jin10',
71
+ Concentrator = 'Concentrator',
72
  }
73
 
74
  export const operatorIconMap = {
 
99
  [Operator.AkShare]: AkShareIcon,
100
  [Operator.YahooFinance]: YahooFinanceIcon,
101
  [Operator.Jin10]: Jin10Icon,
102
+ [Operator.Concentrator]: ConcentratorIcon,
103
  };
104
 
105
  export const operatorMap: Record<
 
213
  [Operator.AkShare]: { backgroundColor: '#8085f5' },
214
  [Operator.YahooFinance]: { backgroundColor: '#b474ff' },
215
  [Operator.Jin10]: { backgroundColor: '#a0b9f8' },
216
+ [Operator.Concentrator]: {
217
+ backgroundColor: '#32d2a3',
218
+ color: 'white',
219
+ width: 70,
220
+ height: 70,
221
+ fontSize: 10,
222
+ iconFontSize: 16,
223
+ },
224
  };
225
 
226
  export const componentMenuList = [
 
251
  {
252
  name: Operator.Switch,
253
  },
254
+ {
255
+ name: Operator.Concentrator,
256
+ },
257
  {
258
  name: Operator.DuckDuckGo,
259
  },
 
465
  filter: '',
466
  };
467
 
468
+ export const initialConcentratorValues = {};
469
+
470
  export const CategorizeAnchorPointPositions = [
471
  { top: 1, right: 34 },
472
  { top: 8, right: 18 },
 
541
  [Operator.AkShare]: [Operator.Begin],
542
  [Operator.YahooFinance]: [Operator.Begin],
543
  [Operator.Jin10]: [Operator.Begin],
544
+ [Operator.Concentrator]: [Operator.Begin],
545
  };
546
 
547
  export const NodeMap = {
 
568
  [Operator.QWeather]: 'ragNode',
569
  [Operator.ExeSQL]: 'ragNode',
570
  [Operator.Switch]: 'categorizeNode',
571
+ [Operator.Concentrator]: 'logicNode',
572
  [Operator.WenCai]: 'ragNode',
573
  [Operator.AkShare]: 'ragNode',
574
  [Operator.YahooFinance]: 'ragNode',
web/src/pages/flow/hooks.ts CHANGED
@@ -38,6 +38,7 @@ import {
38
  initialBeginValues,
39
  initialBingValues,
40
  initialCategorizeValues,
 
41
  initialDeepLValues,
42
  initialDuckValues,
43
  initialExeSqlValues,
@@ -121,6 +122,7 @@ export const useInitializeOperatorParams = () => {
121
  [Operator.AkShare]: initialAkShareValues,
122
  [Operator.YahooFinance]: initialYahooFinanceValues,
123
  [Operator.Jin10]: initialJin10Values,
 
124
  };
125
  }, [llmId]);
126
 
 
38
  initialBeginValues,
39
  initialBingValues,
40
  initialCategorizeValues,
41
+ initialConcentratorValues,
42
  initialDeepLValues,
43
  initialDuckValues,
44
  initialExeSqlValues,
 
122
  [Operator.AkShare]: initialAkShareValues,
123
  [Operator.YahooFinance]: initialYahooFinanceValues,
124
  [Operator.Jin10]: initialJin10Values,
125
+ [Operator.Concentrator]: initialConcentratorValues,
126
  };
127
  }, [llmId]);
128