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 icon to graph nodes #918 (#1117)
balibabuff5ea266d2e6
diff --git a/web/src/pages/chat/hooks.ts b/web/src/pages/chat/hooks.tsindex 7aef84389b..115174f841 100644--- a/web/src/pages/chat/hooks.ts+++ b/web/src/pages/chat/hooks.ts@@ -552,14 +552,12 @@ export const useSendMessage = (const { conversationId } = useGetChatSearchParams();const { handleInputChange, value, setValue } = useHandleMessageInputChange();- const fetchConversation = useFetchConversation();-const { handleClickConversation } = useClickConversationCard();const { send, answer, done } = useSendMessageWithSse();const sendMessage = useCallback(async (message: string, id?: string) => {- const res: Response = await send({+ const res = await send({conversation_id: id ?? conversationId,messages: [...(conversation?.message ?? []).map((x: IMessage) => omit(x, 'id')),@@ -570,7 +568,12 @@ export const useSendMessage = (],});- if (res.status === 200) {+ if (res && (res?.response.status !== 200 || res?.data?.retcode !== 0)) {+ // cancel loading+ setValue(message);+ console.info('removeLatestMessage111');+ removeLatestMessage();+ } else {if (id) {console.info('111');// new conversation@@ -579,15 +582,7 @@ export const useSendMessage = (console.info('222');// fetchConversation(conversationId);}- } else {- console.info('333');-- // cancel loading- setValue(message);- console.info('removeLatestMessage111');- removeLatestMessage();}- console.info('false');},[conversation?.message,diff --git a/web/src/pages/chat/shared-hooks.ts b/web/src/pages/chat/shared-hooks.tsindex 92072a3e93..d406ff95dc 100644--- a/web/src/pages/chat/shared-hooks.ts+++ b/web/src/pages/chat/shared-hooks.ts@@ -150,7 +150,7 @@ export const useSendSharedMessage = (const sendMessage = useCallback(async (message: string, id?: string) => {- const res: Response = await send({+ const res = await send({conversation_id: id ?? conversationId,quote: false,messages: [@@ -162,12 +162,7 @@ export const useSendSharedMessage = (],});- if (res?.status === 200) {- // const data = await fetchConversation(conversationId);- // if (data.retcode === 0) {- // setCurrentConversation(data.data);- // }- } else {+ if (res && (res?.response.status !== 200 || res?.data?.retcode !== 0)) {// cancel loadingsetValue(message);removeLatestMessage();diff --git a/web/src/pages/flow/canvas/node/index.tsx b/web/src/pages/flow/canvas/node/index.tsxindex bd501799dd..c9c19c6a50 100644--- a/web/src/pages/flow/canvas/node/index.tsx+++ b/web/src/pages/flow/canvas/node/index.tsx@@ -1,6 +1,9 @@import classNames from 'classnames';import { Handle, NodeProps, Position } from 'reactflow';+import { Space } from 'antd';+import { Operator } from '../../constant';+import OperatorIcon from '../../operator-icon';import styles from './index.less';export function TextUpdaterNode({@@ -9,7 +12,7 @@ export function TextUpdaterNode({selected,}: NodeProps<{ label: string }>) {return (- <div+ <sectionclassName={classNames(styles.textUpdaterNode, {[styles.selectedNode]: selected,})}@@ -30,7 +33,15 @@ export function TextUpdaterNode({>{/* <PlusCircleOutlined style={{ fontSize: 10 }} /> */}</Handle>- <div>{data.label}</div>- </div>+ <div>+ <Space>+ <OperatorIcon+ name={data.label as Operator}+ fontSize={12}+ ></OperatorIcon>+ {data.label}+ </Space>+ </div>+ </section>);}diff --git a/web/src/pages/flow/chat/hooks.ts b/web/src/pages/flow/chat/hooks.tsindex 49027b5670..a44d27506e 100644--- a/web/src/pages/flow/chat/hooks.ts+++ b/web/src/pages/flow/chat/hooks.ts@@ -112,7 +112,7 @@ export const useSendMessage = (}const res = await send(params);- if (res?.response.status !== 200 || res?.data?.retcode !== 0) {+ if (res && (res?.response.status !== 200 || res?.data?.retcode !== 0)) {antMessage.error(res?.data?.retmsg);// cancel loadingdiff --git a/web/src/pages/flow/constant.tsx b/web/src/pages/flow/constant.tsxindex ccd42b6c0e..5fb0f06ee0 100644--- a/web/src/pages/flow/constant.tsx+++ b/web/src/pages/flow/constant.tsx@@ -2,6 +2,7 @@ import {MergeCellsOutlined,RocketOutlined,SendOutlined,+ SlidersOutlined,} from '@ant-design/icons';export enum Operator {@@ -11,10 +12,26 @@ export enum Operator {Answer = 'Answer',}+export const operatorIconMap = {+ [Operator.Retrieval]: RocketOutlined,+ [Operator.Generate]: MergeCellsOutlined,+ [Operator.Answer]: SendOutlined,+ [Operator.Begin]: SlidersOutlined,+};+export const componentList = [- { name: Operator.Retrieval, icon: <RocketOutlined />, description: '' },- { name: Operator.Generate, icon: <MergeCellsOutlined />, description: '' },- { name: Operator.Answer, icon: <SendOutlined />, description: '' },+ {+ name: Operator.Retrieval,+ description: '',+ },+ {+ name: Operator.Generate,+ description: '',+ },+ {+ name: Operator.Answer,+ description: '',+ },];export const initialRetrievalValues = {diff --git a/web/src/pages/flow/flow-sider/index.tsx b/web/src/pages/flow/flow-sider/index.tsxindex 4841964467..29d7b25932 100644--- a/web/src/pages/flow/flow-sider/index.tsx+++ b/web/src/pages/flow/flow-sider/index.tsx@@ -1,8 +1,9 @@-import { Avatar, Card, Flex, Layout, Space } from 'antd';+import { Card, Flex, Layout, Space } from 'antd';import classNames from 'classnames';import { componentList } from '../constant';import { useHandleDrag } from '../hooks';+import OperatorIcon from '../operator-icon';import styles from './index.less';const { Sider } = Layout;@@ -24,25 +25,31 @@ const FlowSide = ({ setCollapsed, collapsed }: IProps) => {onCollapse={(value) => setCollapsed(value)}><Flex vertical gap={10} className={styles.siderContent}>- {componentList.map((x) => (- <Card- key={x.name}- hoverable- draggable- className={classNames(styles.operatorCard)}- onDragStart={handleDragStart(x.name)}- >- <Flex justify="space-between" align="center">- <Space size={15}>- <Avatar icon={x.icon} shape={'square'} />- <section>- <b>{x.name}</b>- <div>{x.description}</div>- </section>- </Space>- </Flex>- </Card>- ))}+ {componentList.map((x) => {+ return (+ <Card+ key={x.name}+ hoverable+ draggable+ className={classNames(styles.operatorCard)}+ onDragStart={handleDragStart(x.name)}+ >+ <Flex justify="space-between" align="center">+ <Space size={15}>+ <OperatorIcon name={x.name}></OperatorIcon>+ {/* <Avatar+ icon={<OperatorIcon name={x.name}></OperatorIcon>}+ shape={'square'}+ /> */}+ <section>+ <b>{x.name}</b>+ <div>{x.description}</div>+ </section>+ </Space>+ </Flex>+ </Card>+ );+ })}</Flex></Sider>);diff --git a/web/src/pages/flow/operator-icon/index.less b/web/src/pages/flow/operator-icon/index.lessnew file mode 100644index 0000000000..b6a992b05b--- /dev/null+++ b/web/src/pages/flow/operator-icon/index.less@@ -0,0 +1,4 @@+.icon {+ color: rgb(59, 118, 244);+ font-size: 24px;+}diff --git a/web/src/pages/flow/operator-icon/index.tsx b/web/src/pages/flow/operator-icon/index.tsxnew file mode 100644index 0000000000..1a006251ce--- /dev/null+++ b/web/src/pages/flow/operator-icon/index.tsx@@ -0,0 +1,16 @@+import React from 'react';+import { Operator, operatorIconMap } from '../constant';++import styles from './index.less';++interface IProps {+ name: Operator;+ fontSize?: number;+}++const OperatorIcon = ({ name, fontSize }: IProps) => {+ const Icon = operatorIconMap[name] || React.Fragment;+ return <Icon className={styles.icon} style={{ fontSize }}></Icon>;+};++export default OperatorIcon;