balibabu
commited on
Commit
·
c54177d
1
Parent(s):
e123321
feat: Add component YahooFinance #1739 (#2561)
Browse files### What problem does this PR solve?
feat: Add component YahooFinance #1739
### Type of change
- [ ] Bug Fix (non-breaking change which fixes an issue)
- [x] New Feature (non-breaking change which adds functionality)
- [ ] Documentation Update
- [ ] Refactoring
- [ ] Performance Improvement
- [ ] Other (please describe):
- web/src/assets/svg/yahoo-finance.svg +34 -0
- web/src/locales/en.ts +6 -0
- web/src/locales/zh-traditional.ts +6 -0
- web/src/locales/zh.ts +6 -0
- web/src/pages/flow/constant.tsx +18 -0
- web/src/pages/flow/flow-drawer/index.tsx +2 -0
- web/src/pages/flow/hooks.ts +2 -0
- web/src/pages/flow/yahoo-finance-form/index.tsx +39 -0
web/src/assets/svg/yahoo-finance.svg
ADDED
|
|
web/src/locales/en.ts
CHANGED
|
@@ -909,6 +909,12 @@ The above is the content you need to summarize.`,
|
|
| 909 |
akShare: 'AkShare',
|
| 910 |
akShareDescription:
|
| 911 |
'This component can be used to obtain news information for the corresponding stock from the Eastmoney website.',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 912 |
},
|
| 913 |
footer: {
|
| 914 |
profile: 'All rights reserved @ React',
|
|
|
|
| 909 |
akShare: 'AkShare',
|
| 910 |
akShareDescription:
|
| 911 |
'This component can be used to obtain news information for the corresponding stock from the Eastmoney website.',
|
| 912 |
+
yahooFinance: 'YahooFinance',
|
| 913 |
+
info: 'Info',
|
| 914 |
+
history: 'History',
|
| 915 |
+
financials: 'Financials',
|
| 916 |
+
balanceSheet: 'Balance sheet',
|
| 917 |
+
cashFlowStatement: 'Cash flow statement',
|
| 918 |
},
|
| 919 |
footer: {
|
| 920 |
profile: 'All rights reserved @ React',
|
web/src/locales/zh-traditional.ts
CHANGED
|
@@ -862,6 +862,12 @@ export default {
|
|
| 862 |
},
|
| 863 |
akShare: 'AkShare',
|
| 864 |
akShareDescription: '此組件可用於從東方財富網取得對應股票的新聞資訊。',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 865 |
},
|
| 866 |
footer: {
|
| 867 |
profile: '“保留所有權利 @ react”',
|
|
|
|
| 862 |
},
|
| 863 |
akShare: 'AkShare',
|
| 864 |
akShareDescription: '此組件可用於從東方財富網取得對應股票的新聞資訊。',
|
| 865 |
+
yahooFinance: '雅虎財經',
|
| 866 |
+
info: '訊息',
|
| 867 |
+
history: '歷史',
|
| 868 |
+
financials: '財務',
|
| 869 |
+
balanceSheet: '資產負債表',
|
| 870 |
+
cashFlowStatement: '現金流量表',
|
| 871 |
},
|
| 872 |
footer: {
|
| 873 |
profile: '“保留所有權利 @ react”',
|
web/src/locales/zh.ts
CHANGED
|
@@ -880,6 +880,12 @@ export default {
|
|
| 880 |
},
|
| 881 |
akShare: 'AkShare',
|
| 882 |
akShareDescription: '该组件可用于从东方财富网站获取相应股票的新闻信息。',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 883 |
},
|
| 884 |
footer: {
|
| 885 |
profile: 'All rights reserved @ React',
|
|
|
|
| 880 |
},
|
| 881 |
akShare: 'AkShare',
|
| 882 |
akShareDescription: '该组件可用于从东方财富网站获取相应股票的新闻信息。',
|
| 883 |
+
yahooFinance: '雅虎财经',
|
| 884 |
+
info: '信息',
|
| 885 |
+
history: '历史',
|
| 886 |
+
financials: '财务',
|
| 887 |
+
balanceSheet: '资产负债表',
|
| 888 |
+
cashFlowStatement: '现金流量表',
|
| 889 |
},
|
| 890 |
footer: {
|
| 891 |
profile: 'All rights reserved @ React',
|
web/src/pages/flow/constant.tsx
CHANGED
|
@@ -15,6 +15,7 @@ import { ReactComponent as QWeatherIcon } from '@/assets/svg/qweather.svg';
|
|
| 15 |
import { ReactComponent as SwitchIcon } from '@/assets/svg/switch.svg';
|
| 16 |
import { ReactComponent as WenCaiIcon } from '@/assets/svg/wencai.svg';
|
| 17 |
import { ReactComponent as WikipediaIcon } from '@/assets/svg/wikipedia.svg';
|
|
|
|
| 18 |
|
| 19 |
import { variableEnabledFieldMap } from '@/constants/chat';
|
| 20 |
import i18n from '@/locales/config';
|
|
@@ -63,6 +64,7 @@ export enum Operator {
|
|
| 63 |
Switch = 'Switch',
|
| 64 |
WenCai = 'WenCai',
|
| 65 |
AkShare = 'AkShare',
|
|
|
|
| 66 |
}
|
| 67 |
|
| 68 |
export const operatorIconMap = {
|
|
@@ -91,6 +93,7 @@ export const operatorIconMap = {
|
|
| 91 |
[Operator.Switch]: SwitchIcon,
|
| 92 |
[Operator.WenCai]: WenCaiIcon,
|
| 93 |
[Operator.AkShare]: AkShareIcon,
|
|
|
|
| 94 |
};
|
| 95 |
|
| 96 |
export const operatorMap: Record<
|
|
@@ -202,6 +205,7 @@ export const operatorMap: Record<
|
|
| 202 |
[Operator.Switch]: { backgroundColor: '#dbaff6' },
|
| 203 |
[Operator.WenCai]: { backgroundColor: '#faac5b' },
|
| 204 |
[Operator.AkShare]: { backgroundColor: '#8085f5' },
|
|
|
|
| 205 |
};
|
| 206 |
|
| 207 |
export const componentMenuList = [
|
|
@@ -277,6 +281,9 @@ export const componentMenuList = [
|
|
| 277 |
{
|
| 278 |
name: Operator.AkShare,
|
| 279 |
},
|
|
|
|
|
|
|
|
|
|
| 280 |
];
|
| 281 |
|
| 282 |
export const initialRetrievalValues = {
|
|
@@ -420,6 +427,15 @@ 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 },
|
|
@@ -492,6 +508,7 @@ export const RestrictedUpstreamMap = {
|
|
| 492 |
[Operator.Switch]: [Operator.Begin],
|
| 493 |
[Operator.WenCai]: [Operator.Begin],
|
| 494 |
[Operator.AkShare]: [Operator.Begin],
|
|
|
|
| 495 |
};
|
| 496 |
|
| 497 |
export const NodeMap = {
|
|
@@ -520,6 +537,7 @@ export const NodeMap = {
|
|
| 520 |
[Operator.Switch]: 'categorizeNode',
|
| 521 |
[Operator.WenCai]: 'ragNode',
|
| 522 |
[Operator.AkShare]: 'ragNode',
|
|
|
|
| 523 |
};
|
| 524 |
|
| 525 |
export const LanguageOptions = [
|
|
|
|
| 15 |
import { ReactComponent as SwitchIcon } from '@/assets/svg/switch.svg';
|
| 16 |
import { ReactComponent as WenCaiIcon } from '@/assets/svg/wencai.svg';
|
| 17 |
import { ReactComponent as WikipediaIcon } from '@/assets/svg/wikipedia.svg';
|
| 18 |
+
import { ReactComponent as YahooFinanceIcon } from '@/assets/svg/yahoo-finance.svg';
|
| 19 |
|
| 20 |
import { variableEnabledFieldMap } from '@/constants/chat';
|
| 21 |
import i18n from '@/locales/config';
|
|
|
|
| 64 |
Switch = 'Switch',
|
| 65 |
WenCai = 'WenCai',
|
| 66 |
AkShare = 'AkShare',
|
| 67 |
+
YahooFinance = 'YahooFinance',
|
| 68 |
}
|
| 69 |
|
| 70 |
export const operatorIconMap = {
|
|
|
|
| 93 |
[Operator.Switch]: SwitchIcon,
|
| 94 |
[Operator.WenCai]: WenCaiIcon,
|
| 95 |
[Operator.AkShare]: AkShareIcon,
|
| 96 |
+
[Operator.YahooFinance]: YahooFinanceIcon,
|
| 97 |
};
|
| 98 |
|
| 99 |
export const operatorMap: Record<
|
|
|
|
| 205 |
[Operator.Switch]: { backgroundColor: '#dbaff6' },
|
| 206 |
[Operator.WenCai]: { backgroundColor: '#faac5b' },
|
| 207 |
[Operator.AkShare]: { backgroundColor: '#8085f5' },
|
| 208 |
+
[Operator.YahooFinance]: { backgroundColor: '#b474ff' },
|
| 209 |
};
|
| 210 |
|
| 211 |
export const componentMenuList = [
|
|
|
|
| 281 |
{
|
| 282 |
name: Operator.AkShare,
|
| 283 |
},
|
| 284 |
+
{
|
| 285 |
+
name: Operator.YahooFinance,
|
| 286 |
+
},
|
| 287 |
];
|
| 288 |
|
| 289 |
export const initialRetrievalValues = {
|
|
|
|
| 427 |
|
| 428 |
export const initialAkShareValues = { top_n: 10 };
|
| 429 |
|
| 430 |
+
export const initialYahooFinanceValues = {
|
| 431 |
+
info: true,
|
| 432 |
+
history: false,
|
| 433 |
+
financials: false,
|
| 434 |
+
balance_sheet: false,
|
| 435 |
+
cash_flow_statement: false,
|
| 436 |
+
news: true,
|
| 437 |
+
};
|
| 438 |
+
|
| 439 |
export const CategorizeAnchorPointPositions = [
|
| 440 |
{ top: 1, right: 34 },
|
| 441 |
{ top: 8, right: 18 },
|
|
|
|
| 508 |
[Operator.Switch]: [Operator.Begin],
|
| 509 |
[Operator.WenCai]: [Operator.Begin],
|
| 510 |
[Operator.AkShare]: [Operator.Begin],
|
| 511 |
+
[Operator.YahooFinance]: [Operator.Begin],
|
| 512 |
};
|
| 513 |
|
| 514 |
export const NodeMap = {
|
|
|
|
| 537 |
[Operator.Switch]: 'categorizeNode',
|
| 538 |
[Operator.WenCai]: 'ragNode',
|
| 539 |
[Operator.AkShare]: 'ragNode',
|
| 540 |
+
[Operator.YahooFinance]: 'ragNode',
|
| 541 |
};
|
| 542 |
|
| 543 |
export const LanguageOptions = [
|
web/src/pages/flow/flow-drawer/index.tsx
CHANGED
|
@@ -32,6 +32,7 @@ import SwitchForm from '../switch-form';
|
|
| 32 |
import WenCaiForm from '../wencai-form';
|
| 33 |
import WikipediaForm from '../wikipedia-form';
|
| 34 |
|
|
|
|
| 35 |
import styles from './index.less';
|
| 36 |
|
| 37 |
interface IProps {
|
|
@@ -64,6 +65,7 @@ const FormMap = {
|
|
| 64 |
[Operator.Switch]: SwitchForm,
|
| 65 |
[Operator.WenCai]: WenCaiForm,
|
| 66 |
[Operator.AkShare]: AkShareForm,
|
|
|
|
| 67 |
};
|
| 68 |
|
| 69 |
const EmptyContent = () => <div>empty</div>;
|
|
|
|
| 32 |
import WenCaiForm from '../wencai-form';
|
| 33 |
import WikipediaForm from '../wikipedia-form';
|
| 34 |
|
| 35 |
+
import YahooFinanceForm from '../yahoo-finance-form';
|
| 36 |
import styles from './index.less';
|
| 37 |
|
| 38 |
interface IProps {
|
|
|
|
| 65 |
[Operator.Switch]: SwitchForm,
|
| 66 |
[Operator.WenCai]: WenCaiForm,
|
| 67 |
[Operator.AkShare]: AkShareForm,
|
| 68 |
+
[Operator.YahooFinance]: YahooFinanceForm,
|
| 69 |
};
|
| 70 |
|
| 71 |
const EmptyContent = () => <div>empty</div>;
|
web/src/pages/flow/hooks.ts
CHANGED
|
@@ -55,6 +55,7 @@ import {
|
|
| 55 |
initialSwitchValues,
|
| 56 |
initialWenCaiValues,
|
| 57 |
initialWikipediaValues,
|
|
|
|
| 58 |
} from './constant';
|
| 59 |
import { ICategorizeForm, IRelevantForm, ISwitchForm } from './interface';
|
| 60 |
import useGraphStore, { RFState } from './store';
|
|
@@ -117,6 +118,7 @@ export const useInitializeOperatorParams = () => {
|
|
| 117 |
[Operator.Switch]: initialSwitchValues,
|
| 118 |
[Operator.WenCai]: initialWenCaiValues,
|
| 119 |
[Operator.AkShare]: initialAkShareValues,
|
|
|
|
| 120 |
};
|
| 121 |
}, [llmId]);
|
| 122 |
|
|
|
|
| 55 |
initialSwitchValues,
|
| 56 |
initialWenCaiValues,
|
| 57 |
initialWikipediaValues,
|
| 58 |
+
initialYahooFinanceValues,
|
| 59 |
} from './constant';
|
| 60 |
import { ICategorizeForm, IRelevantForm, ISwitchForm } from './interface';
|
| 61 |
import useGraphStore, { RFState } from './store';
|
|
|
|
| 118 |
[Operator.Switch]: initialSwitchValues,
|
| 119 |
[Operator.WenCai]: initialWenCaiValues,
|
| 120 |
[Operator.AkShare]: initialAkShareValues,
|
| 121 |
+
[Operator.YahooFinance]: initialYahooFinanceValues,
|
| 122 |
};
|
| 123 |
}, [llmId]);
|
| 124 |
|
web/src/pages/flow/yahoo-finance-form/index.tsx
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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>
|
| 20 |
+
<Form.Item label={t('history')} name={'history'}>
|
| 21 |
+
<Switch></Switch>
|
| 22 |
+
</Form.Item>
|
| 23 |
+
<Form.Item label={t('financials')} name={'financials'}>
|
| 24 |
+
<Switch></Switch>
|
| 25 |
+
</Form.Item>
|
| 26 |
+
<Form.Item label={t('balanceSheet')} name={'balance_sheet'}>
|
| 27 |
+
<Switch></Switch>
|
| 28 |
+
</Form.Item>
|
| 29 |
+
<Form.Item label={t('cashFlowStatement')} name={'cash_flow_statement'}>
|
| 30 |
+
<Switch></Switch>
|
| 31 |
+
</Form.Item>
|
| 32 |
+
<Form.Item label={t('news')} name={'news'}>
|
| 33 |
+
<Switch></Switch>
|
| 34 |
+
</Form.Item>
|
| 35 |
+
</Form>
|
| 36 |
+
);
|
| 37 |
+
};
|
| 38 |
+
|
| 39 |
+
export default YahooFinanceForm;
|