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: pull the message list after sending the message successfully #918 (#1364)
balibabudec3bf7503da
diff --git a/web/src/hooks/flow-hooks.ts b/web/src/hooks/flow-hooks.tsindex 5bb8af6cdf..c56ccf75f7 100644--- a/web/src/hooks/flow-hooks.ts+++ b/web/src/hooks/flow-hooks.ts@@ -80,9 +80,17 @@ export const useFetchFlowList = (): { data: IFlow[]; loading: boolean } => {return { data, loading };};-export const useFetchFlow = (): { data: IFlow; loading: boolean } => {+export const useFetchFlow = (): {+ data: IFlow;+ loading: boolean;+ refetch: () => void;+} => {const { id } = useParams();- const { data, isFetching: loading } = useQuery({+ const {+ data,+ isFetching: loading,+ refetch,+ } = useQuery({queryKey: ['flowDetail'],initialData: {} as IFlow,queryFn: async () => {@@ -92,7 +100,7 @@ export const useFetchFlow = (): { data: IFlow; loading: boolean } => {},});- return { data, loading };+ return { data, loading, refetch };};export const useSetFlow = () => {diff --git a/web/src/pages/flow/canvas/index.tsx b/web/src/pages/flow/canvas/index.tsxindex 08ab72d2b3..ed674b3576 100644--- a/web/src/pages/flow/canvas/index.tsx+++ b/web/src/pages/flow/canvas/index.tsx@@ -133,10 +133,12 @@ function FlowCanvas({ chatDrawerVisible, hideChatDrawer }: IProps) {visible={drawerVisible}hideModal={hideDrawer}></FlowDrawer>- <ChatDrawer- visible={chatDrawerVisible}- hideModal={hideChatDrawer}- ></ChatDrawer>+ {chatDrawerVisible && (+ <ChatDrawer+ visible={chatDrawerVisible}+ hideModal={hideChatDrawer}+ ></ChatDrawer>+ )}</div>);}diff --git a/web/src/pages/flow/chat/drawer.tsx b/web/src/pages/flow/chat/drawer.tsxindex 99c413c07d..44c0078c89 100644--- a/web/src/pages/flow/chat/drawer.tsx+++ b/web/src/pages/flow/chat/drawer.tsx@@ -10,7 +10,7 @@ const ChatDrawer = ({ visible, hideModal }: IModalProps<any>) => {onClose={hideModal}open={visible}getContainer={false}- width={470}+ width={window.innerWidth > 1278 ? '30%' : 470}mask={false}// zIndex={10000}>diff --git a/web/src/pages/flow/chat/hooks.ts b/web/src/pages/flow/chat/hooks.tsindex a44d27506e..0916eb6acd 100644--- a/web/src/pages/flow/chat/hooks.ts+++ b/web/src/pages/flow/chat/hooks.ts@@ -48,19 +48,15 @@ export const useSelectCurrentMessages = () => {const addNewestAnswer = useCallback((answer: IAnswer) => {setCurrentMessages((pre) => {- const latestMessage = pre?.at(-1);-- if (latestMessage) {- return [- ...pre.slice(0, -1),- {- ...latestMessage,- content: answer.answer,- reference: answer.reference,- },- ];- }- return pre;+ return [+ ...pre.slice(0, -1),+ {+ id: uuid(),+ role: MessageType.Assistant,+ content: answer.answer,+ reference: answer.reference,+ },+ ];});}, []);@@ -97,7 +93,7 @@ export const useSendMessage = () => {const { id: flowId } = useParams();const { handleInputChange, value, setValue } = useHandleMessageInputChange();- const { data: flowDetail } = useFetchFlow();+ const { data: flowDetail, refetch } = useFetchFlow();const messages = flowDetail.dsl.messages;const { send, answer, done } = useSendMessageWithSse(api.runCanvas);@@ -118,9 +114,11 @@ export const useSendMessage = (// cancel loadingsetValue(message);removeLatestMessage();+ } else {+ refetch(); // pull the message list after sending the message successfully}},- [flowId, removeLatestMessage, setValue, send],+ [flowId, removeLatestMessage, setValue, send, refetch],);const handleSendMessage = useCallback(