balibabu
commited on
Commit
·
6dc139b
1
Parent(s):
55e7b7a
feat: Add component AkShare #1739 (#2390)
Browse files### What problem does this PR solve?
feat: Add component AkShare #1739
### Type of change
- [x] New Feature (non-breaking change which adds functionality)
- web/src/assets/svg/akshare.svg +847 -0
- web/src/assets/svg/wencai.svg +1 -1
- web/src/locales/en.ts +3 -0
- web/src/locales/zh-traditional.ts +2 -0
- web/src/locales/zh.ts +2 -0
- web/src/pages/flow/akshare-form/index.tsx +20 -0
- web/src/pages/flow/constant.tsx +11 -0
- web/src/pages/flow/flow-drawer/index.tsx +2 -0
- web/src/pages/flow/hooks.ts +2 -0
- web/src/pages/flow/wencai-form/index.tsx +1 -1
web/src/assets/svg/akshare.svg
ADDED
|
web/src/assets/svg/wencai.svg
CHANGED
|
|
web/src/locales/en.ts
CHANGED
@@ -892,6 +892,9 @@ The above is the content you need to summarize.`,
|
|
892 |
lccp: 'Financing',
|
893 |
foreign_exchange: 'Foreign currency',
|
894 |
},
|
|
|
|
|
|
|
895 |
},
|
896 |
footer: {
|
897 |
profile: 'All rights reserved @ React',
|
|
|
892 |
lccp: 'Financing',
|
893 |
foreign_exchange: 'Foreign currency',
|
894 |
},
|
895 |
+
akShare: 'AkShare',
|
896 |
+
akShareDescription:
|
897 |
+
'This component can be used to obtain news information for the corresponding stock from the Eastmoney website.',
|
898 |
},
|
899 |
footer: {
|
900 |
profile: 'All rights reserved @ React',
|
web/src/locales/zh-traditional.ts
CHANGED
@@ -846,6 +846,8 @@ export default {
|
|
846 |
lccp: '理財',
|
847 |
foreign_exchange: '股票',
|
848 |
},
|
|
|
|
|
849 |
},
|
850 |
footer: {
|
851 |
profile: '“保留所有權利 @ react”',
|
|
|
846 |
lccp: '理財',
|
847 |
foreign_exchange: '股票',
|
848 |
},
|
849 |
+
akShare: 'AkShare',
|
850 |
+
akShareDescription: '此組件可用於從東方財富網取得對應股票的新聞資訊。',
|
851 |
},
|
852 |
footer: {
|
853 |
profile: '“保留所有權利 @ react”',
|
web/src/locales/zh.ts
CHANGED
@@ -864,6 +864,8 @@ export default {
|
|
864 |
lccp: '理财',
|
865 |
foreign_exchange: '股票',
|
866 |
},
|
|
|
|
|
867 |
},
|
868 |
footer: {
|
869 |
profile: 'All rights reserved @ React',
|
|
|
864 |
lccp: '理财',
|
865 |
foreign_exchange: '股票',
|
866 |
},
|
867 |
+
akShare: 'AkShare',
|
868 |
+
akShareDescription: '该组件可用于从东方财富网站获取相应股票的新闻信息。',
|
869 |
},
|
870 |
footer: {
|
871 |
profile: 'All rights reserved @ React',
|
web/src/pages/flow/akshare-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 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 |
+
);
|
18 |
+
};
|
19 |
+
|
20 |
+
export default AkShareForm;
|
web/src/pages/flow/constant.tsx
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
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';
|
@@ -61,6 +62,7 @@ export enum Operator {
|
|
61 |
ExeSQL = 'ExeSQL',
|
62 |
Switch = 'Switch',
|
63 |
WenCai = 'WenCai',
|
|
|
64 |
}
|
65 |
|
66 |
export const operatorIconMap = {
|
@@ -88,6 +90,7 @@ export const operatorIconMap = {
|
|
88 |
[Operator.ExeSQL]: ExeSqlIcon,
|
89 |
[Operator.Switch]: SwitchIcon,
|
90 |
[Operator.WenCai]: WenCaiIcon,
|
|
|
91 |
};
|
92 |
|
93 |
export const operatorMap: Record<
|
@@ -198,6 +201,7 @@ export const operatorMap: Record<
|
|
198 |
[Operator.ExeSQL]: { backgroundColor: '#b9efe8' },
|
199 |
[Operator.Switch]: { backgroundColor: '#dbaff6' },
|
200 |
[Operator.WenCai]: { backgroundColor: '#faac5b' },
|
|
|
201 |
};
|
202 |
|
203 |
export const componentMenuList = [
|
@@ -270,6 +274,9 @@ export const componentMenuList = [
|
|
270 |
{
|
271 |
name: Operator.WenCai,
|
272 |
},
|
|
|
|
|
|
|
273 |
];
|
274 |
|
275 |
export const initialRetrievalValues = {
|
@@ -411,6 +418,8 @@ export const initialSwitchValues = { conditions: [] };
|
|
411 |
|
412 |
export const initialWenCaiValues = { top_n: 20, query_type: 'stock' };
|
413 |
|
|
|
|
|
414 |
export const CategorizeAnchorPointPositions = [
|
415 |
{ top: 1, right: 34 },
|
416 |
{ top: 8, right: 18 },
|
@@ -482,6 +491,7 @@ export const RestrictedUpstreamMap = {
|
|
482 |
[Operator.ExeSQL]: [Operator.Begin],
|
483 |
[Operator.Switch]: [Operator.Begin],
|
484 |
[Operator.WenCai]: [Operator.Begin],
|
|
|
485 |
};
|
486 |
|
487 |
export const NodeMap = {
|
@@ -509,6 +519,7 @@ export const NodeMap = {
|
|
509 |
[Operator.ExeSQL]: 'ragNode',
|
510 |
[Operator.Switch]: 'categorizeNode',
|
511 |
[Operator.WenCai]: 'ragNode',
|
|
|
512 |
};
|
513 |
|
514 |
export const LanguageOptions = [
|
|
|
1 |
+
import { ReactComponent as AkShareIcon } from '@/assets/svg/akshare.svg';
|
2 |
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';
|
|
|
62 |
ExeSQL = 'ExeSQL',
|
63 |
Switch = 'Switch',
|
64 |
WenCai = 'WenCai',
|
65 |
+
AkShare = 'AkShare',
|
66 |
}
|
67 |
|
68 |
export const operatorIconMap = {
|
|
|
90 |
[Operator.ExeSQL]: ExeSqlIcon,
|
91 |
[Operator.Switch]: SwitchIcon,
|
92 |
[Operator.WenCai]: WenCaiIcon,
|
93 |
+
[Operator.AkShare]: AkShareIcon,
|
94 |
};
|
95 |
|
96 |
export const operatorMap: Record<
|
|
|
201 |
[Operator.ExeSQL]: { backgroundColor: '#b9efe8' },
|
202 |
[Operator.Switch]: { backgroundColor: '#dbaff6' },
|
203 |
[Operator.WenCai]: { backgroundColor: '#faac5b' },
|
204 |
+
[Operator.AkShare]: { backgroundColor: '#8085f5' },
|
205 |
};
|
206 |
|
207 |
export const componentMenuList = [
|
|
|
274 |
{
|
275 |
name: Operator.WenCai,
|
276 |
},
|
277 |
+
{
|
278 |
+
name: Operator.AkShare,
|
279 |
+
},
|
280 |
];
|
281 |
|
282 |
export const initialRetrievalValues = {
|
|
|
418 |
|
419 |
export const initialWenCaiValues = { top_n: 20, query_type: 'stock' };
|
420 |
|
421 |
+
export const initialAkShareValues = { top_n: 10 };
|
422 |
+
|
423 |
export const CategorizeAnchorPointPositions = [
|
424 |
{ top: 1, right: 34 },
|
425 |
{ top: 8, right: 18 },
|
|
|
491 |
[Operator.ExeSQL]: [Operator.Begin],
|
492 |
[Operator.Switch]: [Operator.Begin],
|
493 |
[Operator.WenCai]: [Operator.Begin],
|
494 |
+
[Operator.AkShare]: [Operator.Begin],
|
495 |
};
|
496 |
|
497 |
export const NodeMap = {
|
|
|
519 |
[Operator.ExeSQL]: 'ragNode',
|
520 |
[Operator.Switch]: 'categorizeNode',
|
521 |
[Operator.WenCai]: 'ragNode',
|
522 |
+
[Operator.AkShare]: 'ragNode',
|
523 |
};
|
524 |
|
525 |
export const LanguageOptions = [
|
web/src/pages/flow/flow-drawer/index.tsx
CHANGED
@@ -3,6 +3,7 @@ import { IModalProps } from '@/interfaces/common';
|
|
3 |
import { Drawer, Flex, Form, Input } from 'antd';
|
4 |
import { useEffect } from 'react';
|
5 |
import { Node } from 'reactflow';
|
|
|
6 |
import AnswerForm from '../answer-form';
|
7 |
import ArXivForm from '../arxiv-form';
|
8 |
import BaiduFanyiForm from '../baidu-fanyi-form';
|
@@ -62,6 +63,7 @@ const FormMap = {
|
|
62 |
[Operator.ExeSQL]: ExeSQLForm,
|
63 |
[Operator.Switch]: SwitchForm,
|
64 |
[Operator.WenCai]: WenCaiForm,
|
|
|
65 |
};
|
66 |
|
67 |
const EmptyContent = () => <div>empty</div>;
|
|
|
3 |
import { Drawer, Flex, Form, Input } from 'antd';
|
4 |
import { useEffect } from 'react';
|
5 |
import { Node } from 'reactflow';
|
6 |
+
import AkShareForm from '../akshare-form';
|
7 |
import AnswerForm from '../answer-form';
|
8 |
import ArXivForm from '../arxiv-form';
|
9 |
import BaiduFanyiForm from '../baidu-fanyi-form';
|
|
|
63 |
[Operator.ExeSQL]: ExeSQLForm,
|
64 |
[Operator.Switch]: SwitchForm,
|
65 |
[Operator.WenCai]: WenCaiForm,
|
66 |
+
[Operator.AkShare]: AkShareForm,
|
67 |
};
|
68 |
|
69 |
const EmptyContent = () => <div>empty</div>;
|
web/src/pages/flow/hooks.ts
CHANGED
@@ -31,6 +31,7 @@ import {
|
|
31 |
Operator,
|
32 |
RestrictedUpstreamMap,
|
33 |
SwitchElseTo,
|
|
|
34 |
initialArXivValues,
|
35 |
initialBaiduFanyiValues,
|
36 |
initialBaiduValues,
|
@@ -115,6 +116,7 @@ export const useInitializeOperatorParams = () => {
|
|
115 |
[Operator.ExeSQL]: initialExeSqlValues,
|
116 |
[Operator.Switch]: initialSwitchValues,
|
117 |
[Operator.WenCai]: initialWenCaiValues,
|
|
|
118 |
};
|
119 |
}, [llmId]);
|
120 |
|
|
|
31 |
Operator,
|
32 |
RestrictedUpstreamMap,
|
33 |
SwitchElseTo,
|
34 |
+
initialAkShareValues,
|
35 |
initialArXivValues,
|
36 |
initialBaiduFanyiValues,
|
37 |
initialBaiduValues,
|
|
|
116 |
[Operator.ExeSQL]: initialExeSqlValues,
|
117 |
[Operator.Switch]: initialSwitchValues,
|
118 |
[Operator.WenCai]: initialWenCaiValues,
|
119 |
+
[Operator.AkShare]: initialAkShareValues,
|
120 |
};
|
121 |
}, [llmId]);
|
122 |
|
web/src/pages/flow/wencai-form/index.tsx
CHANGED
@@ -24,7 +24,7 @@ const WenCaiForm = ({ onValuesChange, form }: IOperatorForm) => {
|
|
24 |
form={form}
|
25 |
onValuesChange={onValuesChange}
|
26 |
>
|
27 |
-
<TopNItem initialValue={
|
28 |
<Form.Item label={t('queryType')} name={'query_type'}>
|
29 |
<Select options={wenCaiQueryTypeOptions}></Select>
|
30 |
</Form.Item>
|
|
|
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>
|
30 |
</Form.Item>
|