### 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):
This commit is contained in:
@@ -15,6 +15,7 @@ import { ReactComponent as QWeatherIcon } from '@/assets/svg/qweather.svg';
|
||||
import { ReactComponent as SwitchIcon } from '@/assets/svg/switch.svg';
|
||||
import { ReactComponent as WenCaiIcon } from '@/assets/svg/wencai.svg';
|
||||
import { ReactComponent as WikipediaIcon } from '@/assets/svg/wikipedia.svg';
|
||||
import { ReactComponent as YahooFinanceIcon } from '@/assets/svg/yahoo-finance.svg';
|
||||
|
||||
import { variableEnabledFieldMap } from '@/constants/chat';
|
||||
import i18n from '@/locales/config';
|
||||
@@ -63,6 +64,7 @@ export enum Operator {
|
||||
Switch = 'Switch',
|
||||
WenCai = 'WenCai',
|
||||
AkShare = 'AkShare',
|
||||
YahooFinance = 'YahooFinance',
|
||||
}
|
||||
|
||||
export const operatorIconMap = {
|
||||
@@ -91,6 +93,7 @@ export const operatorIconMap = {
|
||||
[Operator.Switch]: SwitchIcon,
|
||||
[Operator.WenCai]: WenCaiIcon,
|
||||
[Operator.AkShare]: AkShareIcon,
|
||||
[Operator.YahooFinance]: YahooFinanceIcon,
|
||||
};
|
||||
|
||||
export const operatorMap: Record<
|
||||
@@ -202,6 +205,7 @@ export const operatorMap: Record<
|
||||
[Operator.Switch]: { backgroundColor: '#dbaff6' },
|
||||
[Operator.WenCai]: { backgroundColor: '#faac5b' },
|
||||
[Operator.AkShare]: { backgroundColor: '#8085f5' },
|
||||
[Operator.YahooFinance]: { backgroundColor: '#b474ff' },
|
||||
};
|
||||
|
||||
export const componentMenuList = [
|
||||
@@ -277,6 +281,9 @@ export const componentMenuList = [
|
||||
{
|
||||
name: Operator.AkShare,
|
||||
},
|
||||
{
|
||||
name: Operator.YahooFinance,
|
||||
},
|
||||
];
|
||||
|
||||
export const initialRetrievalValues = {
|
||||
@@ -420,6 +427,15 @@ export const initialWenCaiValues = { top_n: 20, query_type: 'stock' };
|
||||
|
||||
export const initialAkShareValues = { top_n: 10 };
|
||||
|
||||
export const initialYahooFinanceValues = {
|
||||
info: true,
|
||||
history: false,
|
||||
financials: false,
|
||||
balance_sheet: false,
|
||||
cash_flow_statement: false,
|
||||
news: true,
|
||||
};
|
||||
|
||||
export const CategorizeAnchorPointPositions = [
|
||||
{ top: 1, right: 34 },
|
||||
{ top: 8, right: 18 },
|
||||
@@ -492,6 +508,7 @@ export const RestrictedUpstreamMap = {
|
||||
[Operator.Switch]: [Operator.Begin],
|
||||
[Operator.WenCai]: [Operator.Begin],
|
||||
[Operator.AkShare]: [Operator.Begin],
|
||||
[Operator.YahooFinance]: [Operator.Begin],
|
||||
};
|
||||
|
||||
export const NodeMap = {
|
||||
@@ -520,6 +537,7 @@ export const NodeMap = {
|
||||
[Operator.Switch]: 'categorizeNode',
|
||||
[Operator.WenCai]: 'ragNode',
|
||||
[Operator.AkShare]: 'ragNode',
|
||||
[Operator.YahooFinance]: 'ragNode',
|
||||
};
|
||||
|
||||
export const LanguageOptions = [
|
||||
|
||||
@@ -32,6 +32,7 @@ import SwitchForm from '../switch-form';
|
||||
import WenCaiForm from '../wencai-form';
|
||||
import WikipediaForm from '../wikipedia-form';
|
||||
|
||||
import YahooFinanceForm from '../yahoo-finance-form';
|
||||
import styles from './index.less';
|
||||
|
||||
interface IProps {
|
||||
@@ -64,6 +65,7 @@ const FormMap = {
|
||||
[Operator.Switch]: SwitchForm,
|
||||
[Operator.WenCai]: WenCaiForm,
|
||||
[Operator.AkShare]: AkShareForm,
|
||||
[Operator.YahooFinance]: YahooFinanceForm,
|
||||
};
|
||||
|
||||
const EmptyContent = () => <div>empty</div>;
|
||||
|
||||
@@ -55,6 +55,7 @@ import {
|
||||
initialSwitchValues,
|
||||
initialWenCaiValues,
|
||||
initialWikipediaValues,
|
||||
initialYahooFinanceValues,
|
||||
} from './constant';
|
||||
import { ICategorizeForm, IRelevantForm, ISwitchForm } from './interface';
|
||||
import useGraphStore, { RFState } from './store';
|
||||
@@ -117,6 +118,7 @@ export const useInitializeOperatorParams = () => {
|
||||
[Operator.Switch]: initialSwitchValues,
|
||||
[Operator.WenCai]: initialWenCaiValues,
|
||||
[Operator.AkShare]: initialAkShareValues,
|
||||
[Operator.YahooFinance]: initialYahooFinanceValues,
|
||||
};
|
||||
}, [llmId]);
|
||||
|
||||
|
||||
39
web/src/pages/flow/yahoo-finance-form/index.tsx
Normal file
39
web/src/pages/flow/yahoo-finance-form/index.tsx
Normal file
@@ -0,0 +1,39 @@
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { Form, Switch } from 'antd';
|
||||
import { IOperatorForm } from '../interface';
|
||||
|
||||
const YahooFinanceForm = ({ onValuesChange, form }: IOperatorForm) => {
|
||||
const { t } = useTranslate('flow');
|
||||
|
||||
return (
|
||||
<Form
|
||||
name="basic"
|
||||
labelCol={{ span: 10 }}
|
||||
wrapperCol={{ span: 14 }}
|
||||
autoComplete="off"
|
||||
form={form}
|
||||
onValuesChange={onValuesChange}
|
||||
>
|
||||
<Form.Item label={t('info')} name={'info'}>
|
||||
<Switch></Switch>
|
||||
</Form.Item>
|
||||
<Form.Item label={t('history')} name={'history'}>
|
||||
<Switch></Switch>
|
||||
</Form.Item>
|
||||
<Form.Item label={t('financials')} name={'financials'}>
|
||||
<Switch></Switch>
|
||||
</Form.Item>
|
||||
<Form.Item label={t('balanceSheet')} name={'balance_sheet'}>
|
||||
<Switch></Switch>
|
||||
</Form.Item>
|
||||
<Form.Item label={t('cashFlowStatement')} name={'cash_flow_statement'}>
|
||||
<Switch></Switch>
|
||||
</Form.Item>
|
||||
<Form.Item label={t('news')} name={'news'}>
|
||||
<Switch></Switch>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
);
|
||||
};
|
||||
|
||||
export default YahooFinanceForm;
|
||||
Reference in New Issue
Block a user