balibabu commited on
Commit
2c5f7df
·
1 Parent(s): 284d945

feat: Add component GitHub #1739 (#1871)

Browse files

### What problem does this PR solve?

feat: Add component GitHub #1739

### Type of change

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

web/src/assets/svg/github.svg ADDED
web/src/locales/en.ts CHANGED
@@ -667,6 +667,9 @@ The above is the content you need to summarize.`,
667
  authKey: 'Auth key',
668
  sourceLang: 'Source language',
669
  targetLang: 'Target language',
 
 
 
670
  },
671
  footer: {
672
  profile: 'All rights reserved @ React',
 
667
  authKey: 'Auth key',
668
  sourceLang: 'Source language',
669
  targetLang: 'Target language',
670
+ gitHub: 'GitHub',
671
+ githubDescription:
672
+ 'This component is used to search the repository from https://github.com/. Top N specifies the number of search results to be adjusted.',
673
  },
674
  footer: {
675
  profile: 'All rights reserved @ React',
web/src/locales/zh-traditional.ts CHANGED
@@ -625,6 +625,9 @@ export default {
625
  authKey: '授權鍵',
626
  sourceLang: '原始語言',
627
  targetLang: '目標語言',
 
 
 
628
  },
629
  footer: {
630
  profile: '“保留所有權利 @ react”',
 
625
  authKey: '授權鍵',
626
  sourceLang: '原始語言',
627
  targetLang: '目標語言',
628
+ gitHub: 'GitHub',
629
+ gitHubDescription:
630
+ '此元件用於從 https://github.com/ 搜尋儲存庫。 Top N 指定要調整的搜尋結果的數量。',
631
  },
632
  footer: {
633
  profile: '“保留所有權利 @ react”',
web/src/locales/zh.ts CHANGED
@@ -643,6 +643,9 @@ export default {
643
  authKey: '授权键',
644
  sourceLang: '源语言',
645
  targetLang: '目标语言',
 
 
 
646
  },
647
  footer: {
648
  profile: 'All rights reserved @ React',
 
643
  authKey: '授权键',
644
  sourceLang: '源语言',
645
  targetLang: '目标语言',
646
+ gitHub: 'GitHub',
647
+ githubDescription:
648
+ '该组件用于从 https://github.com/ 搜索仓库。Top N 指定需要调整的搜索结果数量。',
649
  },
650
  footer: {
651
  profile: 'All rights reserved @ React',
web/src/pages/flow/constant.tsx CHANGED
@@ -3,6 +3,7 @@ import { ReactComponent as BaiduIcon } from '@/assets/svg/baidu.svg';
3
  import { ReactComponent as BingIcon } from '@/assets/svg/bing.svg';
4
  import { ReactComponent as DeepLIcon } from '@/assets/svg/deepl.svg';
5
  import { ReactComponent as DuckIcon } from '@/assets/svg/duck.svg';
 
6
  import { ReactComponent as GoogleScholarIcon } from '@/assets/svg/google-scholar.svg';
7
  import { ReactComponent as GoogleIcon } from '@/assets/svg/google.svg';
8
  import { ReactComponent as KeywordIcon } from '@/assets/svg/keyword.svg';
@@ -48,6 +49,7 @@ export enum Operator {
48
  Bing = 'Bing',
49
  GoogleScholar = 'GoogleScholar',
50
  DeepL = 'DeepL',
 
51
  }
52
 
53
  export const operatorIconMap = {
@@ -69,6 +71,7 @@ export const operatorIconMap = {
69
  [Operator.Bing]: BingIcon,
70
  [Operator.GoogleScholar]: GoogleScholarIcon,
71
  [Operator.DeepL]: DeepLIcon,
 
72
  };
73
 
74
  export const operatorMap = {
@@ -153,6 +156,7 @@ export const operatorMap = {
153
  [Operator.Bing]: {},
154
  [Operator.GoogleScholar]: {},
155
  [Operator.DeepL]: {},
 
156
  };
157
 
158
  export const componentMenuList = [
@@ -207,6 +211,9 @@ export const componentMenuList = [
207
  {
208
  name: Operator.DeepL,
209
  },
 
 
 
210
  ];
211
 
212
  export const initialRetrievalValues = {
@@ -316,6 +323,10 @@ export const initialDeepLValues = {
316
  auth_key: 'relevance',
317
  };
318
 
 
 
 
 
319
  export const CategorizeAnchorPointPositions = [
320
  { top: 1, right: 34 },
321
  { top: 8, right: 18 },
@@ -381,6 +392,7 @@ export const RestrictedUpstreamMap = {
381
  [Operator.Bing]: [Operator.Begin, Operator.Retrieval],
382
  [Operator.GoogleScholar]: [Operator.Begin, Operator.Retrieval],
383
  [Operator.DeepL]: [Operator.Begin, Operator.Retrieval],
 
384
  };
385
 
386
  export const NodeMap = {
@@ -402,6 +414,7 @@ export const NodeMap = {
402
  [Operator.Bing]: 'ragNode',
403
  [Operator.GoogleScholar]: 'ragNode',
404
  [Operator.DeepL]: 'ragNode',
 
405
  };
406
 
407
  export const LanguageOptions = [
 
3
  import { ReactComponent as BingIcon } from '@/assets/svg/bing.svg';
4
  import { ReactComponent as DeepLIcon } from '@/assets/svg/deepl.svg';
5
  import { ReactComponent as DuckIcon } from '@/assets/svg/duck.svg';
6
+ import { ReactComponent as GithubIcon } from '@/assets/svg/github.svg';
7
  import { ReactComponent as GoogleScholarIcon } from '@/assets/svg/google-scholar.svg';
8
  import { ReactComponent as GoogleIcon } from '@/assets/svg/google.svg';
9
  import { ReactComponent as KeywordIcon } from '@/assets/svg/keyword.svg';
 
49
  Bing = 'Bing',
50
  GoogleScholar = 'GoogleScholar',
51
  DeepL = 'DeepL',
52
+ GitHub = 'GitHub',
53
  }
54
 
55
  export const operatorIconMap = {
 
71
  [Operator.Bing]: BingIcon,
72
  [Operator.GoogleScholar]: GoogleScholarIcon,
73
  [Operator.DeepL]: DeepLIcon,
74
+ [Operator.GitHub]: GithubIcon,
75
  };
76
 
77
  export const operatorMap = {
 
156
  [Operator.Bing]: {},
157
  [Operator.GoogleScholar]: {},
158
  [Operator.DeepL]: {},
159
+ [Operator.GitHub]: {},
160
  };
161
 
162
  export const componentMenuList = [
 
211
  {
212
  name: Operator.DeepL,
213
  },
214
+ {
215
+ name: Operator.GitHub,
216
+ },
217
  ];
218
 
219
  export const initialRetrievalValues = {
 
323
  auth_key: 'relevance',
324
  };
325
 
326
+ export const initialGithubValues = {
327
+ top_n: 5,
328
+ };
329
+
330
  export const CategorizeAnchorPointPositions = [
331
  { top: 1, right: 34 },
332
  { top: 8, right: 18 },
 
392
  [Operator.Bing]: [Operator.Begin, Operator.Retrieval],
393
  [Operator.GoogleScholar]: [Operator.Begin, Operator.Retrieval],
394
  [Operator.DeepL]: [Operator.Begin, Operator.Retrieval],
395
+ [Operator.GitHub]: [Operator.Begin, Operator.Retrieval],
396
  };
397
 
398
  export const NodeMap = {
 
414
  [Operator.Bing]: 'ragNode',
415
  [Operator.GoogleScholar]: 'ragNode',
416
  [Operator.DeepL]: 'ragNode',
417
+ [Operator.GitHub]: 'ragNode',
418
  };
419
 
420
  export const LanguageOptions = [
web/src/pages/flow/flow-drawer/index.tsx CHANGED
@@ -12,6 +12,7 @@ import CategorizeForm from '../categorize-form';
12
  import { Operator } from '../constant';
13
  import DuckDuckGoForm from '../duckduckgo-form';
14
  import GenerateForm from '../generate-form';
 
15
  import GoogleForm from '../google-form';
16
  import GoogleScholarForm from '../google-scholar-form';
17
  import { useHandleFormValuesChange, useHandleNodeNameChange } from '../hooks';
@@ -50,6 +51,7 @@ const FormMap = {
50
  [Operator.Bing]: BingForm,
51
  [Operator.GoogleScholar]: GoogleScholarForm,
52
  [Operator.DeepL]: DeepLForm,
 
53
  };
54
 
55
  const EmptyContent = () => <div>empty</div>;
 
12
  import { Operator } from '../constant';
13
  import DuckDuckGoForm from '../duckduckgo-form';
14
  import GenerateForm from '../generate-form';
15
+ import GithubForm from '../github-form';
16
  import GoogleForm from '../google-form';
17
  import GoogleScholarForm from '../google-scholar-form';
18
  import { useHandleFormValuesChange, useHandleNodeNameChange } from '../hooks';
 
51
  [Operator.Bing]: BingForm,
52
  [Operator.GoogleScholar]: GoogleScholarForm,
53
  [Operator.DeepL]: DeepLForm,
54
+ [Operator.GitHub]: GithubForm,
55
  };
56
 
57
  const EmptyContent = () => <div>empty</div>;
web/src/pages/flow/github-form/index.tsx ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ );
18
+ };
19
+
20
+ export default GithubForm;
web/src/pages/flow/hooks.ts CHANGED
@@ -38,6 +38,7 @@ import {
38
  initialDeepLValues,
39
  initialDuckValues,
40
  initialGenerateValues,
 
41
  initialGoogleScholarValues,
42
  initialGoogleValues,
43
  initialKeywordExtractValues,
@@ -101,6 +102,7 @@ export const useInitializeOperatorParams = () => {
101
  [Operator.Bing]: initialBingValues,
102
  [Operator.GoogleScholar]: initialGoogleScholarValues,
103
  [Operator.DeepL]: initialDeepLValues,
 
104
  };
105
  }, [llmId]);
106
 
 
38
  initialDeepLValues,
39
  initialDuckValues,
40
  initialGenerateValues,
41
+ initialGithubValues,
42
  initialGoogleScholarValues,
43
  initialGoogleValues,
44
  initialKeywordExtractValues,
 
102
  [Operator.Bing]: initialBingValues,
103
  [Operator.GoogleScholar]: initialGoogleScholarValues,
104
  [Operator.DeepL]: initialDeepLValues,
105
+ [Operator.GitHub]: initialGithubValues,
106
  };
107
  }, [llmId]);
108