balibabu
commited on
Commit
·
4c2d648
1
Parent(s):
2c5f7df
feat: Add component BaiduFanyi #1739 (#1874)
Browse files### What problem does this PR solve?
feat: Add component BaiduFanyi #1739
### Type of change
- [x] New Feature (non-breaking change which adds functionality)
- web/src/assets/svg/baidu-fanyi.svg +6 -0
- web/src/locales/en.ts +55 -0
- web/src/locales/zh-traditional.ts +55 -0
- web/src/locales/zh.ts +55 -0
- web/src/pages/flow/baidu-fanyi-form/index.tsx +70 -0
- web/src/pages/flow/constant.tsx +61 -0
- web/src/pages/flow/flow-drawer/index.tsx +2 -0
- web/src/pages/flow/flow-sider/index.less +2 -0
- web/src/pages/flow/hooks.ts +2 -0
web/src/assets/svg/baidu-fanyi.svg
ADDED
|
|
web/src/locales/en.ts
CHANGED
|
@@ -670,6 +670,61 @@ The above is the content you need to summarize.`,
|
|
| 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',
|
|
|
|
| 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 |
+
baiduFanyi: 'BaiduFanyi',
|
| 674 |
+
baiduFanyiDescription:
|
| 675 |
+
'This component is used to get translations from https://fanyi.baidu.com/. Typically, it provides a more specialized translation result',
|
| 676 |
+
appid: 'App id',
|
| 677 |
+
secretKey: 'Secret key',
|
| 678 |
+
domain: 'Domain',
|
| 679 |
+
transType: 'Translation type',
|
| 680 |
+
baiduSecretKeyOptions: {
|
| 681 |
+
translate: 'General translation',
|
| 682 |
+
fieldtranslate: 'Field translation',
|
| 683 |
+
},
|
| 684 |
+
baiduDomainOptions: {
|
| 685 |
+
it: 'Information technology',
|
| 686 |
+
finance: 'Financial and economics',
|
| 687 |
+
machinery: 'Machinery manufacturing',
|
| 688 |
+
senimed: 'Biomedicine',
|
| 689 |
+
novel: 'Online literature',
|
| 690 |
+
academic: 'Academic paper',
|
| 691 |
+
aerospace: 'Aerospace',
|
| 692 |
+
wiki: 'Humanities and social sciences',
|
| 693 |
+
news: 'News and information',
|
| 694 |
+
law: 'Laws and regulations',
|
| 695 |
+
contract: 'Contract',
|
| 696 |
+
},
|
| 697 |
+
baiduSourceLangOptions: {
|
| 698 |
+
auto: 'Auto detect',
|
| 699 |
+
zh: 'Chinese',
|
| 700 |
+
en: 'English',
|
| 701 |
+
yue: 'Cantonese',
|
| 702 |
+
wyw: 'Classical Chinese',
|
| 703 |
+
jp: 'Japanese',
|
| 704 |
+
kor: 'Korean',
|
| 705 |
+
fra: 'French',
|
| 706 |
+
spa: 'Spanish',
|
| 707 |
+
th: 'Thai',
|
| 708 |
+
ara: 'Arabic',
|
| 709 |
+
ru: 'Russian',
|
| 710 |
+
pt: 'Portuguese',
|
| 711 |
+
de: 'German',
|
| 712 |
+
it: 'Italian',
|
| 713 |
+
el: 'Greek',
|
| 714 |
+
nl: 'Dutch',
|
| 715 |
+
pl: 'Polish',
|
| 716 |
+
bul: 'Bulgarian',
|
| 717 |
+
est: 'Estonian',
|
| 718 |
+
dan: 'Danish',
|
| 719 |
+
fin: 'Finnish',
|
| 720 |
+
cs: 'Czech',
|
| 721 |
+
rom: 'Romanian',
|
| 722 |
+
slo: 'Slovenian',
|
| 723 |
+
swe: 'Swedish',
|
| 724 |
+
hu: 'Hungarian',
|
| 725 |
+
cht: 'Traditional Chinese',
|
| 726 |
+
vie: 'Vietnamese',
|
| 727 |
+
},
|
| 728 |
},
|
| 729 |
footer: {
|
| 730 |
profile: 'All rights reserved @ React',
|
web/src/locales/zh-traditional.ts
CHANGED
|
@@ -628,6 +628,61 @@ export default {
|
|
| 628 |
gitHub: 'GitHub',
|
| 629 |
gitHubDescription:
|
| 630 |
'此元件用於從 https://github.com/ 搜尋儲存庫。 Top N 指定要調整的搜尋結果的數量。',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 631 |
},
|
| 632 |
footer: {
|
| 633 |
profile: '“保留所有權利 @ react”',
|
|
|
|
| 628 |
gitHub: 'GitHub',
|
| 629 |
gitHubDescription:
|
| 630 |
'此元件用於從 https://github.com/ 搜尋儲存庫。 Top N 指定要調整的搜尋結果的數量。',
|
| 631 |
+
baiduFanyi: '百度翻譯',
|
| 632 |
+
baiduFanyiDescription:
|
| 633 |
+
'此組件用於從https://fanyi.baidu.com/取得翻譯。通常,它提供更專業的翻譯結果',
|
| 634 |
+
appid: 'App id',
|
| 635 |
+
secretKey: '秘鑰',
|
| 636 |
+
domain: '領域',
|
| 637 |
+
transType: '翻譯類型',
|
| 638 |
+
baiduSecretKeyOptions: {
|
| 639 |
+
translate: '一般翻譯',
|
| 640 |
+
fieldtranslate: '領域翻譯',
|
| 641 |
+
},
|
| 642 |
+
baiduDomainOptions: {
|
| 643 |
+
it: '資訊科技領域',
|
| 644 |
+
finance: '金融財經領域',
|
| 645 |
+
machinery: '機械製造領域',
|
| 646 |
+
senimed: '生物醫藥領域',
|
| 647 |
+
novel: '網路文學領域',
|
| 648 |
+
academic: '學術論文領域',
|
| 649 |
+
aerospace: '航空航太領域',
|
| 650 |
+
wiki: '人文社科領域',
|
| 651 |
+
news: '新聞資訊領域',
|
| 652 |
+
law: '法律法規領域',
|
| 653 |
+
contract: '合約領域',
|
| 654 |
+
},
|
| 655 |
+
baiduSourceLangOptions: {
|
| 656 |
+
auto: '自動偵測',
|
| 657 |
+
zh: '中文',
|
| 658 |
+
en: '英語',
|
| 659 |
+
yue: '粵語',
|
| 660 |
+
wyw: '文言文',
|
| 661 |
+
jp: '日文',
|
| 662 |
+
kor: '韓文',
|
| 663 |
+
fra: '法文',
|
| 664 |
+
spa: '西班牙文',
|
| 665 |
+
th: '泰語',
|
| 666 |
+
ara: '阿拉伯語',
|
| 667 |
+
ru: '俄文',
|
| 668 |
+
pt: '葡萄牙語',
|
| 669 |
+
de: '德語',
|
| 670 |
+
it: '義大利語',
|
| 671 |
+
el: '希臘文',
|
| 672 |
+
nl: '荷蘭語',
|
| 673 |
+
pl: '波蘭語',
|
| 674 |
+
bul: '保加利亞語',
|
| 675 |
+
est: '愛沙尼亞語',
|
| 676 |
+
dan: '丹麥語',
|
| 677 |
+
fin: '芬蘭語',
|
| 678 |
+
cs: '捷克語',
|
| 679 |
+
rom: '羅馬尼亞語',
|
| 680 |
+
slo: '斯洛維尼亞語',
|
| 681 |
+
swe: '瑞典語',
|
| 682 |
+
hu: '匈牙利語',
|
| 683 |
+
cht: '繁體中文',
|
| 684 |
+
vie: '越南語',
|
| 685 |
+
},
|
| 686 |
},
|
| 687 |
footer: {
|
| 688 |
profile: '“保留所有權利 @ react”',
|
web/src/locales/zh.ts
CHANGED
|
@@ -646,6 +646,61 @@ export default {
|
|
| 646 |
gitHub: 'GitHub',
|
| 647 |
githubDescription:
|
| 648 |
'该组件用于从 https://github.com/ 搜索仓库。Top N 指定需要调整的搜索结果数量。',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 649 |
},
|
| 650 |
footer: {
|
| 651 |
profile: 'All rights reserved @ React',
|
|
|
|
| 646 |
gitHub: 'GitHub',
|
| 647 |
githubDescription:
|
| 648 |
'该组件用于从 https://github.com/ 搜索仓库。Top N 指定需要调整的搜索结果数量。',
|
| 649 |
+
baiduFanyi: '百度翻译',
|
| 650 |
+
baiduFanyiDescription:
|
| 651 |
+
'该组件用于从 https://fanyi.baidu.com/ 获取翻译。通常,它提供更专业的翻译结果',
|
| 652 |
+
appid: 'App id',
|
| 653 |
+
secretKey: '秘钥',
|
| 654 |
+
domain: '领域',
|
| 655 |
+
transType: '翻译类型',
|
| 656 |
+
baiduSecretKeyOptions: {
|
| 657 |
+
translate: '通用翻译',
|
| 658 |
+
fieldtranslate: '领域翻译',
|
| 659 |
+
},
|
| 660 |
+
baiduDomainOptions: {
|
| 661 |
+
it: '信息技术领域',
|
| 662 |
+
finance: '金融财经领域',
|
| 663 |
+
machinery: '机械制造领域',
|
| 664 |
+
senimed: '生物医药领域',
|
| 665 |
+
novel: '网络文学领域',
|
| 666 |
+
academic: '学术论文领域',
|
| 667 |
+
aerospace: '航空航天领域',
|
| 668 |
+
wiki: '人文社科领域',
|
| 669 |
+
news: '新闻资讯领域',
|
| 670 |
+
law: '法律法规领域',
|
| 671 |
+
contract: '合同领域',
|
| 672 |
+
},
|
| 673 |
+
baiduSourceLangOptions: {
|
| 674 |
+
auto: '自动检测',
|
| 675 |
+
zh: '中文',
|
| 676 |
+
en: '英语',
|
| 677 |
+
yue: '粤语',
|
| 678 |
+
wyw: '文言文',
|
| 679 |
+
jp: '日语',
|
| 680 |
+
kor: '韩语',
|
| 681 |
+
fra: '法语',
|
| 682 |
+
spa: '西班牙语',
|
| 683 |
+
th: '泰语',
|
| 684 |
+
ara: '阿拉伯语',
|
| 685 |
+
ru: '俄语',
|
| 686 |
+
pt: '葡萄牙语',
|
| 687 |
+
de: '德语',
|
| 688 |
+
it: '意大利语',
|
| 689 |
+
el: '希腊语',
|
| 690 |
+
nl: '荷兰语',
|
| 691 |
+
pl: '波兰语',
|
| 692 |
+
bul: '保加利亚语',
|
| 693 |
+
est: '爱沙尼亚语',
|
| 694 |
+
dan: '丹麦语',
|
| 695 |
+
fin: '芬兰语',
|
| 696 |
+
cs: '捷克语',
|
| 697 |
+
rom: '罗马尼亚语',
|
| 698 |
+
slo: '斯洛文尼亚语',
|
| 699 |
+
swe: '瑞典语',
|
| 700 |
+
hu: '匈牙利语',
|
| 701 |
+
cht: '繁体中文',
|
| 702 |
+
vie: '越南语',
|
| 703 |
+
},
|
| 704 |
},
|
| 705 |
footer: {
|
| 706 |
profile: 'All rights reserved @ React',
|
web/src/pages/flow/baidu-fanyi-form/index.tsx
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { useTranslate } from '@/hooks/common-hooks';
|
| 2 |
+
import { Form, Input, Select } from 'antd';
|
| 3 |
+
import { useMemo } from 'react';
|
| 4 |
+
import {
|
| 5 |
+
BaiduFanyiDomainOptions,
|
| 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) => ({
|
| 14 |
+
value: x,
|
| 15 |
+
label: t(`baiduSecretKeyOptions.${x}`),
|
| 16 |
+
}));
|
| 17 |
+
}, [t]);
|
| 18 |
+
|
| 19 |
+
const baiduFanyiOptions = useMemo(() => {
|
| 20 |
+
return BaiduFanyiDomainOptions.map((x) => ({
|
| 21 |
+
value: x,
|
| 22 |
+
label: t(`baiduDomainOptions.${x}`),
|
| 23 |
+
}));
|
| 24 |
+
}, [t]);
|
| 25 |
+
|
| 26 |
+
const baiduFanyiSourceLangOptions = useMemo(() => {
|
| 27 |
+
return BaiduFanyiSourceLangOptions.map((x) => ({
|
| 28 |
+
value: x,
|
| 29 |
+
label: t(`baiduSourceLangOptions.${x}`),
|
| 30 |
+
}));
|
| 31 |
+
}, [t]);
|
| 32 |
+
|
| 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>
|
| 45 |
+
<Form.Item label={t('secretKey')} name={'secret_key'}>
|
| 46 |
+
<Input></Input>
|
| 47 |
+
</Form.Item>
|
| 48 |
+
<Form.Item label={t('transType')} name={'trans_type'}>
|
| 49 |
+
<Select options={options}></Select>
|
| 50 |
+
</Form.Item>
|
| 51 |
+
<Form.Item noStyle dependencies={['model_type']}>
|
| 52 |
+
{({ getFieldValue }) =>
|
| 53 |
+
getFieldValue('trans_type') === 'fieldtranslate' && (
|
| 54 |
+
<Form.Item label={t('domain')} name={'domain'}>
|
| 55 |
+
<Select options={baiduFanyiOptions}></Select>
|
| 56 |
+
</Form.Item>
|
| 57 |
+
)
|
| 58 |
+
}
|
| 59 |
+
</Form.Item>
|
| 60 |
+
<Form.Item label={t('sourceLang')} name={'source_lang'}>
|
| 61 |
+
<Select options={baiduFanyiSourceLangOptions}></Select>
|
| 62 |
+
</Form.Item>
|
| 63 |
+
<Form.Item label={t('targetLang')} name={'target_lang'}>
|
| 64 |
+
<Select options={baiduFanyiSourceLangOptions}></Select>
|
| 65 |
+
</Form.Item>
|
| 66 |
+
</Form>
|
| 67 |
+
);
|
| 68 |
+
};
|
| 69 |
+
|
| 70 |
+
export default BaiduFanyiForm;
|
web/src/pages/flow/constant.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import { ReactComponent as ArXivIcon } from '@/assets/svg/arxiv.svg';
|
|
|
|
| 2 |
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';
|
|
@@ -50,6 +51,7 @@ export enum Operator {
|
|
| 50 |
GoogleScholar = 'GoogleScholar',
|
| 51 |
DeepL = 'DeepL',
|
| 52 |
GitHub = 'GitHub',
|
|
|
|
| 53 |
}
|
| 54 |
|
| 55 |
export const operatorIconMap = {
|
|
@@ -72,6 +74,7 @@ export const operatorIconMap = {
|
|
| 72 |
[Operator.GoogleScholar]: GoogleScholarIcon,
|
| 73 |
[Operator.DeepL]: DeepLIcon,
|
| 74 |
[Operator.GitHub]: GithubIcon,
|
|
|
|
| 75 |
};
|
| 76 |
|
| 77 |
export const operatorMap = {
|
|
@@ -157,6 +160,7 @@ export const operatorMap = {
|
|
| 157 |
[Operator.GoogleScholar]: {},
|
| 158 |
[Operator.DeepL]: {},
|
| 159 |
[Operator.GitHub]: {},
|
|
|
|
| 160 |
};
|
| 161 |
|
| 162 |
export const componentMenuList = [
|
|
@@ -214,6 +218,9 @@ export const componentMenuList = [
|
|
| 214 |
{
|
| 215 |
name: Operator.GitHub,
|
| 216 |
},
|
|
|
|
|
|
|
|
|
|
| 217 |
];
|
| 218 |
|
| 219 |
export const initialRetrievalValues = {
|
|
@@ -327,6 +334,12 @@ export const initialGithubValues = {
|
|
| 327 |
top_n: 5,
|
| 328 |
};
|
| 329 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 330 |
export const CategorizeAnchorPointPositions = [
|
| 331 |
{ top: 1, right: 34 },
|
| 332 |
{ top: 8, right: 18 },
|
|
@@ -393,6 +406,7 @@ export const RestrictedUpstreamMap = {
|
|
| 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 = {
|
|
@@ -415,6 +429,7 @@ export const NodeMap = {
|
|
| 415 |
[Operator.GoogleScholar]: 'ragNode',
|
| 416 |
[Operator.DeepL]: 'ragNode',
|
| 417 |
[Operator.GitHub]: 'ragNode',
|
|
|
|
| 418 |
};
|
| 419 |
|
| 420 |
export const LanguageOptions = [
|
|
@@ -2452,3 +2467,49 @@ export const DeepLTargetLangOptions = [
|
|
| 2452 |
{ label: 'Ukrainian', value: 'UK' },
|
| 2453 |
{ label: 'Chinese (simplified)', value: 'ZH' },
|
| 2454 |
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import { ReactComponent as ArXivIcon } from '@/assets/svg/arxiv.svg';
|
| 2 |
+
import { ReactComponent as baiduFanyiIcon } from '@/assets/svg/baidu-fanyi.svg';
|
| 3 |
import { ReactComponent as BaiduIcon } from '@/assets/svg/baidu.svg';
|
| 4 |
import { ReactComponent as BingIcon } from '@/assets/svg/bing.svg';
|
| 5 |
import { ReactComponent as DeepLIcon } from '@/assets/svg/deepl.svg';
|
|
|
|
| 51 |
GoogleScholar = 'GoogleScholar',
|
| 52 |
DeepL = 'DeepL',
|
| 53 |
GitHub = 'GitHub',
|
| 54 |
+
BaiduFanyi = 'BaiduFanyi',
|
| 55 |
}
|
| 56 |
|
| 57 |
export const operatorIconMap = {
|
|
|
|
| 74 |
[Operator.GoogleScholar]: GoogleScholarIcon,
|
| 75 |
[Operator.DeepL]: DeepLIcon,
|
| 76 |
[Operator.GitHub]: GithubIcon,
|
| 77 |
+
[Operator.BaiduFanyi]: baiduFanyiIcon,
|
| 78 |
};
|
| 79 |
|
| 80 |
export const operatorMap = {
|
|
|
|
| 160 |
[Operator.GoogleScholar]: {},
|
| 161 |
[Operator.DeepL]: {},
|
| 162 |
[Operator.GitHub]: {},
|
| 163 |
+
[Operator.BaiduFanyi]: {},
|
| 164 |
};
|
| 165 |
|
| 166 |
export const componentMenuList = [
|
|
|
|
| 218 |
{
|
| 219 |
name: Operator.GitHub,
|
| 220 |
},
|
| 221 |
+
{
|
| 222 |
+
name: Operator.BaiduFanyi,
|
| 223 |
+
},
|
| 224 |
];
|
| 225 |
|
| 226 |
export const initialRetrievalValues = {
|
|
|
|
| 334 |
top_n: 5,
|
| 335 |
};
|
| 336 |
|
| 337 |
+
export const initialBaiduFanyiValues = {
|
| 338 |
+
appid: 'xxx',
|
| 339 |
+
secret_key: 'xxx',
|
| 340 |
+
trans_type: 'translate',
|
| 341 |
+
};
|
| 342 |
+
|
| 343 |
export const CategorizeAnchorPointPositions = [
|
| 344 |
{ top: 1, right: 34 },
|
| 345 |
{ top: 8, right: 18 },
|
|
|
|
| 406 |
[Operator.GoogleScholar]: [Operator.Begin, Operator.Retrieval],
|
| 407 |
[Operator.DeepL]: [Operator.Begin, Operator.Retrieval],
|
| 408 |
[Operator.GitHub]: [Operator.Begin, Operator.Retrieval],
|
| 409 |
+
[Operator.BaiduFanyi]: [Operator.Begin, Operator.Retrieval],
|
| 410 |
};
|
| 411 |
|
| 412 |
export const NodeMap = {
|
|
|
|
| 429 |
[Operator.GoogleScholar]: 'ragNode',
|
| 430 |
[Operator.DeepL]: 'ragNode',
|
| 431 |
[Operator.GitHub]: 'ragNode',
|
| 432 |
+
[Operator.BaiduFanyi]: 'ragNode',
|
| 433 |
};
|
| 434 |
|
| 435 |
export const LanguageOptions = [
|
|
|
|
| 2467 |
{ label: 'Ukrainian', value: 'UK' },
|
| 2468 |
{ label: 'Chinese (simplified)', value: 'ZH' },
|
| 2469 |
];
|
| 2470 |
+
|
| 2471 |
+
export const BaiduFanyiDomainOptions = [
|
| 2472 |
+
'it',
|
| 2473 |
+
'finance',
|
| 2474 |
+
'machinery',
|
| 2475 |
+
'senimed',
|
| 2476 |
+
'novel',
|
| 2477 |
+
'academic',
|
| 2478 |
+
'aerospace',
|
| 2479 |
+
'wiki',
|
| 2480 |
+
'news',
|
| 2481 |
+
'law',
|
| 2482 |
+
'contract',
|
| 2483 |
+
];
|
| 2484 |
+
|
| 2485 |
+
export const BaiduFanyiSourceLangOptions = [
|
| 2486 |
+
'auto',
|
| 2487 |
+
'zh',
|
| 2488 |
+
'en',
|
| 2489 |
+
'yue',
|
| 2490 |
+
'wyw',
|
| 2491 |
+
'jp',
|
| 2492 |
+
'kor',
|
| 2493 |
+
'fra',
|
| 2494 |
+
'spa',
|
| 2495 |
+
'th',
|
| 2496 |
+
'ara',
|
| 2497 |
+
'ru',
|
| 2498 |
+
'pt',
|
| 2499 |
+
'de',
|
| 2500 |
+
'it',
|
| 2501 |
+
'el',
|
| 2502 |
+
'nl',
|
| 2503 |
+
'pl',
|
| 2504 |
+
'bul',
|
| 2505 |
+
'est',
|
| 2506 |
+
'dan',
|
| 2507 |
+
'fin',
|
| 2508 |
+
'cs',
|
| 2509 |
+
'rom',
|
| 2510 |
+
'slo',
|
| 2511 |
+
'swe',
|
| 2512 |
+
'hu',
|
| 2513 |
+
'cht',
|
| 2514 |
+
'vie',
|
| 2515 |
+
];
|
web/src/pages/flow/flow-drawer/index.tsx
CHANGED
|
@@ -5,6 +5,7 @@ import { useEffect } from 'react';
|
|
| 5 |
import { Node } from 'reactflow';
|
| 6 |
import AnswerForm from '../answer-form';
|
| 7 |
import ArXivForm from '../arxiv-form';
|
|
|
|
| 8 |
import BaiduForm from '../baidu-form';
|
| 9 |
import BeginForm from '../begin-form';
|
| 10 |
import BingForm from '../bing-form';
|
|
@@ -52,6 +53,7 @@ const FormMap = {
|
|
| 52 |
[Operator.GoogleScholar]: GoogleScholarForm,
|
| 53 |
[Operator.DeepL]: DeepLForm,
|
| 54 |
[Operator.GitHub]: GithubForm,
|
|
|
|
| 55 |
};
|
| 56 |
|
| 57 |
const EmptyContent = () => <div>empty</div>;
|
|
|
|
| 5 |
import { Node } from 'reactflow';
|
| 6 |
import AnswerForm from '../answer-form';
|
| 7 |
import ArXivForm from '../arxiv-form';
|
| 8 |
+
import BaiduFanyiForm from '../baidu-fanyi-form';
|
| 9 |
import BaiduForm from '../baidu-form';
|
| 10 |
import BeginForm from '../begin-form';
|
| 11 |
import BingForm from '../bing-form';
|
|
|
|
| 53 |
[Operator.GoogleScholar]: GoogleScholarForm,
|
| 54 |
[Operator.DeepL]: DeepLForm,
|
| 55 |
[Operator.GitHub]: GithubForm,
|
| 56 |
+
[Operator.BaiduFanyi]: BaiduFanyiForm,
|
| 57 |
};
|
| 58 |
|
| 59 |
const EmptyContent = () => <div>empty</div>;
|
web/src/pages/flow/flow-sider/index.less
CHANGED
|
@@ -11,4 +11,6 @@
|
|
| 11 |
|
| 12 |
.siderContent {
|
| 13 |
padding: 10px 4px;
|
|
|
|
|
|
|
| 14 |
}
|
|
|
|
| 11 |
|
| 12 |
.siderContent {
|
| 13 |
padding: 10px 4px;
|
| 14 |
+
overflow: auto;
|
| 15 |
+
height: calc(100vh - 80px);
|
| 16 |
}
|
web/src/pages/flow/hooks.ts
CHANGED
|
@@ -31,6 +31,7 @@ import {
|
|
| 31 |
Operator,
|
| 32 |
RestrictedUpstreamMap,
|
| 33 |
initialArXivValues,
|
|
|
|
| 34 |
initialBaiduValues,
|
| 35 |
initialBeginValues,
|
| 36 |
initialBingValues,
|
|
@@ -103,6 +104,7 @@ export const useInitializeOperatorParams = () => {
|
|
| 103 |
[Operator.GoogleScholar]: initialGoogleScholarValues,
|
| 104 |
[Operator.DeepL]: initialDeepLValues,
|
| 105 |
[Operator.GitHub]: initialGithubValues,
|
|
|
|
| 106 |
};
|
| 107 |
}, [llmId]);
|
| 108 |
|
|
|
|
| 31 |
Operator,
|
| 32 |
RestrictedUpstreamMap,
|
| 33 |
initialArXivValues,
|
| 34 |
+
initialBaiduFanyiValues,
|
| 35 |
initialBaiduValues,
|
| 36 |
initialBeginValues,
|
| 37 |
initialBingValues,
|
|
|
|
| 104 |
[Operator.GoogleScholar]: initialGoogleScholarValues,
|
| 105 |
[Operator.DeepL]: initialDeepLValues,
|
| 106 |
[Operator.GitHub]: initialGithubValues,
|
| 107 |
+
[Operator.BaiduFanyi]: initialBaiduFanyiValues,
|
| 108 |
};
|
| 109 |
}, [llmId]);
|
| 110 |
|