RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
feat: Add component YahooFinance #1739 (#2561)
balibabu949a99947860
diff --git a/web/src/assets/svg/yahoo-finance.svg b/web/src/assets/svg/yahoo-finance.svgnew file mode 100644index 0000000000..9bf55ce2f6--- /dev/null+++ b/web/src/assets/svg/yahoo-finance.svg@@ -0,0 +1,34 @@+<?xml version="1.0" encoding="UTF-8"?>+<svg width="28px" height="28px" viewBox="0 0 28 28" version="1.1" xmlns="http://www.w3.org/2000/svg"+ xmlns:xlink="http://www.w3.org/1999/xlink">+ <!-- Generator: Sketch 57.1 (83088) - https://sketch.com -->+ <title>favicon_y19_28x28_custom</title>+ <desc>Created with Sketch.</desc>+ <defs>+ <polygon id="path-1"+ points="0.171073913 0.0931111111 9.4455087 0.0931111111 9.4455087 9.92442222 0.171073913 9.92442222">+ </polygon>+ </defs>+ <g id="favicon_y19_28x28_custom" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">+ <rect fill="#6001D2" x="0" y="0" width="28" height="28"></rect>+ <g id="y!" transform="translate(5.000000, 6.000000)">+ <polygon id="Fill-1" fill="#FFFFFF"+ points="9.70835927 5 7.04604411 11.4197051 4.40657437 5 0 5 4.91176421 16.0265583 3.14442407 20 7.45914574 20 14 5">+ </polygon>+ <g id="!" transform="translate(12.000000, 0.000000)">+ <path+ d="M2.88747609,10.8773778 C1.30283696,10.8773778 0.114280435,12.0684889 0.114280435,13.4547111 C0.114280435,14.8184889 1.25660652,15.9449333 2.79421522,15.9449333 C4.37917174,15.9449333 5.56741087,14.7756 5.56741087,13.3678222 C5.56741087,11.9818222 4.42580217,10.8773778 2.88747609,10.8773778"+ id="Fill-2" fill="#FFFFFF"></path>+ <g id="Group-6" transform="translate(1.434783, 0.000000)">+ <mask id="mask-2" fill="white">+ <use xlink:href="#path-1"></use>+ </mask>+ <g id="Clip-5"></g>+ <polygon id="Fill-4" fill="#FFFFFF" mask="url(#mask-2)"+ points="4.55194348 0.0930888889 0.171073913 9.92442222 5.06487826 9.92442222 9.4455087 0.0930888889">+ </polygon>+ </g>+ </g>+ </g>+ </g>+</svg>\ No newline at end of filediff --git a/web/src/locales/en.ts b/web/src/locales/en.tsindex 3ca925a478..4f83ac78c3 100644--- a/web/src/locales/en.ts+++ b/web/src/locales/en.ts@@ -909,6 +909,12 @@ The above is the content you need to summarize.`,akShare: 'AkShare',akShareDescription:'This component can be used to obtain news information for the corresponding stock from the Eastmoney website.',+ yahooFinance: 'YahooFinance',+ info: 'Info',+ history: 'History',+ financials: 'Financials',+ balanceSheet: 'Balance sheet',+ cashFlowStatement: 'Cash flow statement',},footer: {profile: 'All rights reserved @ React',diff --git a/web/src/locales/zh-traditional.ts b/web/src/locales/zh-traditional.tsindex d7241fe48b..258bcf8fa5 100644--- a/web/src/locales/zh-traditional.ts+++ b/web/src/locales/zh-traditional.ts@@ -862,6 +862,12 @@ export default {},akShare: 'AkShare',akShareDescription: '此組件可用於從東方財富網取得對應股票的新聞資訊。',+ yahooFinance: '雅虎財經',+ info: '訊息',+ history: '歷史',+ financials: '財務',+ balanceSheet: '資產負債表',+ cashFlowStatement: '現金流量表',},footer: {profile: '“保留所有權利 @ react”',diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.tsindex 88b0ff705f..6d6c09741d 100644--- a/web/src/locales/zh.ts+++ b/web/src/locales/zh.ts@@ -880,6 +880,12 @@ export default {},akShare: 'AkShare',akShareDescription: '该组件可用于从东方财富网站获取相应股票的新闻信息。',+ yahooFinance: '雅虎财经',+ info: '信息',+ history: '历史',+ financials: '财务',+ balanceSheet: '资产负债表',+ cashFlowStatement: '现金流量表',},footer: {profile: 'All rights reserved @ React',diff --git a/web/src/pages/flow/constant.tsx b/web/src/pages/flow/constant.tsxindex 7f45bf7340..4765c27b5e 100644--- a/web/src/pages/flow/constant.tsx+++ b/web/src/pages/flow/constant.tsx@@ -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 = [diff --git a/web/src/pages/flow/flow-drawer/index.tsx b/web/src/pages/flow/flow-drawer/index.tsxindex f763749049..66fff21a7a 100644--- a/web/src/pages/flow/flow-drawer/index.tsx+++ b/web/src/pages/flow/flow-drawer/index.tsx@@ -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>;diff --git a/web/src/pages/flow/hooks.ts b/web/src/pages/flow/hooks.tsindex 508619f719..d5e49caa1f 100644--- a/web/src/pages/flow/hooks.ts+++ b/web/src/pages/flow/hooks.ts@@ -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]);diff --git a/web/src/pages/flow/yahoo-finance-form/index.tsx b/web/src/pages/flow/yahoo-finance-form/index.tsxnew file mode 100644index 0000000000..59b125f504--- /dev/null+++ b/web/src/pages/flow/yahoo-finance-form/index.tsx@@ -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;