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
Fix:The dialog will display the referenced documentation even if the API does not return any documentation data. (#18298)
balibabua897a25aa75f
diff --git a/web/src/pages/next-chats/chat/index.tsx b/web/src/pages/next-chats/chat/index.tsxindex 1f8602fd3b..eab833464b 100644--- a/web/src/pages/next-chats/chat/index.tsx+++ b/web/src/pages/next-chats/chat/index.tsx@@ -8,10 +8,9 @@ import {import { IClientConversation } from '@/interfaces/database/chat';import { RootLayoutContainer } from '@/layouts/root-layout';import { cn } from '@/lib/utils';-import { useMount } from 'ahooks';import { isEmpty } from 'lodash';import { LucideArrowBigLeft, LucideArrowUpRight } from 'lucide-react';-import { useCallback, useMemo, useState } from 'react';+import { useEffect, useMemo, useState } from 'react';import { useTranslation } from 'react-i18next';import { useHandleClickConversationCard } from '../hooks/use-click-card';import { ChatSettings } from './app-settings/chat-settings';@@ -46,32 +45,26 @@ export default function Chat() {);}, [conversationId, dialogList, t]);- const fetchConversation: typeof handleConversationCardClick = useCallback(- async (conversationId, isNew) => {- if (conversationId && !isNew) {- const conversation = await fetchSessionManually(conversationId);- if (!isEmpty(conversation)) {- setCurrentConversation(conversation);- }- } else {- // New session: clear previous session's messages so they don't leak in.- setCurrentConversation({} as IClientConversation);- }- },- [fetchSessionManually],- );-- const handleSessionClick: typeof handleConversationCardClick = useCallback(- (conversationId, isNew) => {- handleConversationCardClick(conversationId, isNew);- fetchConversation(conversationId, isNew);- },- [fetchConversation, handleConversationCardClick],- );+ // The URL is the single source of truth for which conversation is open:+ // card clicks, "+" and the temp→real id swap after the first send all land+ // here. Clear first so the previous conversation's messages and references+ // can never leak into the newly opened one while the fetch is in flight.+ useEffect(() => {+ setCurrentConversation((previous) =>+ isEmpty(previous) ? previous : ({} as IClientConversation),+ );+ if (!conversationId || isNew === 'true') return;- useMount(() => {- fetchConversation(conversationId, isNew === 'true');- });+ let cancelled = false;+ fetchSessionManually(conversationId).then((conversation) => {+ if (!cancelled && !isEmpty(conversation)) {+ setCurrentConversation(conversation);+ }+ });+ return () => {+ cancelled = true;+ };+ }, [conversationId, isNew, fetchSessionManually]);if (isDebugMode) {return (@@ -112,7 +105,9 @@ export default function Chat() {<RootLayoutContainer><section className="h-full flex flex-col" data-testid="chat-detail"><article className="flex flex-1 min-h-0 pb-9">- <Sessions handleConversationCardClick={handleSessionClick}></Sessions>+ <Sessions+ handleConversationCardClick={handleConversationCardClick}+ ></Sessions><Card className="flex-1 min-w-0 bg-transparent border-none shadow-none h-full"><CardContent className="flex p-0 h-full">