diff --git a/web/src/assets/svg/arxiv.svg b/web/src/assets/svg/arxiv.svg index a30b325e1..ce8cb9a23 100644 --- a/web/src/assets/svg/arxiv.svg +++ b/web/src/assets/svg/arxiv.svg @@ -1,18 +1,26 @@ - - - - - - + + + arxiv + + + + + + \ No newline at end of file diff --git a/web/src/assets/svg/bing.svg b/web/src/assets/svg/bing.svg index df74cd60c..379c6f3a5 100644 --- a/web/src/assets/svg/bing.svg +++ b/web/src/assets/svg/bing.svg @@ -1,7 +1,32 @@ - - - - - + + + bing + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/web/src/assets/svg/duck.svg b/web/src/assets/svg/duck.svg index 3e4a07677..2cf46353a 100644 --- a/web/src/assets/svg/duck.svg +++ b/web/src/assets/svg/duck.svg @@ -1,20 +1,27 @@ - - - - - - - - - + + + duckgo + + + + + + \ No newline at end of file diff --git a/web/src/assets/svg/github.svg b/web/src/assets/svg/github.svg index 92c08f50d..198f08848 100644 --- a/web/src/assets/svg/github.svg +++ b/web/src/assets/svg/github.svg @@ -1,6 +1,22 @@ - - + + + GitHub + + + + + + \ No newline at end of file diff --git a/web/src/assets/svg/google-scholar.svg b/web/src/assets/svg/google-scholar.svg index 973763a16..40c50536a 100644 --- a/web/src/assets/svg/google-scholar.svg +++ b/web/src/assets/svg/google-scholar.svg @@ -1,9 +1,25 @@ - - - - - + + + Google scholar + + + + + + \ No newline at end of file diff --git a/web/src/assets/svg/google.svg b/web/src/assets/svg/google.svg index 117a38864..2e60e15a4 100644 --- a/web/src/assets/svg/google.svg +++ b/web/src/assets/svg/google.svg @@ -1,15 +1,18 @@ - - - - - + + + serpapi + + + + + + \ No newline at end of file diff --git a/web/src/assets/svg/pubmed.svg b/web/src/assets/svg/pubmed.svg index 6a17fa89c..2c0bb0468 100644 --- a/web/src/assets/svg/pubmed.svg +++ b/web/src/assets/svg/pubmed.svg @@ -1,6 +1,26 @@ - - - + + + pubmed + + + + + + \ No newline at end of file diff --git a/web/src/assets/svg/tavily.svg b/web/src/assets/svg/tavily.svg new file mode 100644 index 000000000..fc3e9f2d1 --- /dev/null +++ b/web/src/assets/svg/tavily.svg @@ -0,0 +1,23 @@ + + + tavily + + + + + + + \ No newline at end of file diff --git a/web/src/assets/svg/wencai.svg b/web/src/assets/svg/wencai.svg index 0010ed8af..bd254d03d 100644 --- a/web/src/assets/svg/wencai.svg +++ b/web/src/assets/svg/wencai.svg @@ -1,152 +1,23 @@ - - - - + + + wencai + + + + + + + \ No newline at end of file diff --git a/web/src/assets/svg/wikipedia.svg b/web/src/assets/svg/wikipedia.svg index ee2f8850e..e9050a25d 100644 --- a/web/src/assets/svg/wikipedia.svg +++ b/web/src/assets/svg/wikipedia.svg @@ -1,6 +1,22 @@ - - + + + wikipedia + + + + + + \ No newline at end of file diff --git a/web/src/assets/svg/yahoo-finance.svg b/web/src/assets/svg/yahoo-finance.svg index 9bf55ce2f..db0b8ebb0 100644 --- a/web/src/assets/svg/yahoo-finance.svg +++ b/web/src/assets/svg/yahoo-finance.svg @@ -1,32 +1,31 @@ - - - favicon_y19_28x28_custom - Created with Sketch. + + yahoofinance - - + + - - - - - - - - - - - - - - + + diff --git a/web/src/pages/agent/canvas/node/dropdown/next-step-dropdown.tsx b/web/src/pages/agent/canvas/node/dropdown/next-step-dropdown.tsx index 1b462bea6..8dc36e7c6 100644 --- a/web/src/pages/agent/canvas/node/dropdown/next-step-dropdown.tsx +++ b/web/src/pages/agent/canvas/node/dropdown/next-step-dropdown.tsx @@ -16,7 +16,7 @@ import { Operator } from '@/pages/agent/constant'; import { AgentInstanceContext, HandleContext } from '@/pages/agent/context'; import OperatorIcon from '@/pages/agent/operator-icon'; import { lowerFirst } from 'lodash'; -import { PropsWithChildren, createContext, useContext } from 'react'; +import { PropsWithChildren, createContext, memo, useContext } from 'react'; import { useTranslation } from 'react-i18next'; type OperatorItemProps = { operators: Operator[] }; @@ -124,7 +124,7 @@ function AccordionOperators() { ); } -export function NextStepDropdown({ +export function InnerNextStepDropdown({ children, hideModal, }: PropsWithChildren & IModalProps) { @@ -143,3 +143,5 @@ export function NextStepDropdown({ ); } + +export const NextStepDropdown = memo(InnerNextStepDropdown); diff --git a/web/src/pages/agent/canvas/node/handle.tsx b/web/src/pages/agent/canvas/node/handle.tsx index 8cd5f6bcd..167e9a3de 100644 --- a/web/src/pages/agent/canvas/node/handle.tsx +++ b/web/src/pages/agent/canvas/node/handle.tsx @@ -4,7 +4,7 @@ import { Handle, HandleProps } from '@xyflow/react'; import { Plus } from 'lucide-react'; import { useMemo } from 'react'; import { HandleContext } from '../../context'; -import { NextStepDropdown } from './dropdown/next-step-dropdown'; +import { InnerNextStepDropdown } from './dropdown/next-step-dropdown'; export function CommonHandle({ className, @@ -38,9 +38,9 @@ export function CommonHandle({ > {visible && ( - + - + )} diff --git a/web/src/pages/agent/operator-icon.tsx b/web/src/pages/agent/operator-icon.tsx index f83e2e60c..74127ff2b 100644 --- a/web/src/pages/agent/operator-icon.tsx +++ b/web/src/pages/agent/operator-icon.tsx @@ -1,4 +1,5 @@ import { IconFont } from '@/components/icon-font'; +import SvgIcon from '@/components/svg-icon'; import { cn } from '@/lib/utils'; import { CirclePlay } from 'lucide-react'; import { Operator } from './constant'; @@ -10,8 +11,6 @@ interface IProps { export const OperatorIconMap = { [Operator.Retrieval]: 'KR', - // [Operator.Generate]: MergeCellsOutlined, - // [Operator.Answer]: SendOutlined, [Operator.Begin]: CirclePlay, [Operator.Categorize]: 'a-QuestionClassification', [Operator.Message]: 'reply', @@ -22,35 +21,25 @@ export const OperatorIconMap = { [Operator.UserFillUp]: 'await', [Operator.StringTransform]: 'a-textprocessing', [Operator.Note]: 'notebook-pen', - // [Operator.Relevant]: BranchesOutlined, - // [Operator.RewriteQuestion]: FormOutlined, - // [Operator.KeywordExtract]: KeywordIcon, - // [Operator.DuckDuckGo]: DuckIcon, - // [Operator.Baidu]: BaiduIcon, - // [Operator.Wikipedia]: WikipediaIcon, - // [Operator.PubMed]: PubMedIcon, - // [Operator.ArXiv]: ArXivIcon, - // [Operator.Google]: GoogleIcon, - // [Operator.Bing]: BingIcon, - // [Operator.GoogleScholar]: GoogleScholarIcon, - // [Operator.DeepL]: DeepLIcon, - // [Operator.GitHub]: GitHubIcon, - // [Operator.BaiduFanyi]: baiduFanyiIcon, - // [Operator.QWeather]: QWeatherIcon, - // [Operator.ExeSQL]: ExeSqlIcon, - // [Operator.WenCai]: WenCaiIcon, - // [Operator.AkShare]: AkShareIcon, - // [Operator.YahooFinance]: YahooFinanceIcon, - // [Operator.Jin10]: Jin10Icon, - // [Operator.Concentrator]: ConcentratorIcon, - // [Operator.TuShare]: TuShareIcon, - // [Operator.Note]: NoteIcon, - // [Operator.Crawler]: CrawlerIcon, - // [Operator.Invoke]: InvokeIcon, - // [Operator.Template]: TemplateIcon, - // [Operator.Email]: EmailIcon, - // [Operator.IterationStart]: CirclePower, - // [Operator.WaitingDialogue]: MessageSquareMore, + [Operator.ExeSQL]: 'executesql-0', + [Operator.Invoke]: 'httprequest-0', + [Operator.Email]: 'sendemail-0', +}; + +const SVGIconMap = { + [Operator.ArXiv]: 'arxiv', + [Operator.GitHub]: 'github', + [Operator.Bing]: 'bing', + [Operator.DuckDuckGo]: 'duck', + [Operator.Google]: 'google', + [Operator.GoogleScholar]: 'google-scholar', + [Operator.PubMed]: 'pubmed', + [Operator.TavilyExtract]: 'tavily', + [Operator.TavilySearch]: 'tavily', + [Operator.Wikipedia]: 'wikipedia', + [Operator.YahooFinance]: 'yahoo-finance', + [Operator.WenCai]: 'wencai', + [Operator.Crawler]: 'crawler', }; const Empty = () => { @@ -60,10 +49,20 @@ const Empty = () => { const OperatorIcon = ({ name, className }: IProps) => { const Icon = OperatorIconMap[name as keyof typeof OperatorIconMap] || Empty; + if (name in SVGIconMap) { + return ( + + ); + } + return typeof Icon === 'string' ? ( ) : ( - + ); };