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(web): regenerate in multi-model chat uses the card's own state and model (#17126)
euvreee8aa03fa095
diff --git a/web/src/components/message-input/next.tsx b/web/src/components/message-input/next.tsxindex edc623dc94..99e7315c90 100644--- a/web/src/components/message-input/next.tsx+++ b/web/src/components/message-input/next.tsx@@ -23,8 +23,8 @@ import { SelectWithSearch } from '../originui/select-with-search';import { AudioButton } from '../ui/audio-button';export type NextMessageInputOnPressEnterParameter = {- enableThinking: string;- enableInternet: boolean;+ enableThinking?: string;+ enableInternet?: boolean;};interface NextMessageInputProps {diff --git a/web/src/pages/next-chats/chat/chat-box/next-multiple-chat-box.tsx b/web/src/pages/next-chats/chat/chat-box/next-multiple-chat-box.tsxindex 6b04b85a75..c8a83ca7f1 100644--- a/web/src/pages/next-chats/chat/chat-box/next-multiple-chat-box.tsx+++ b/web/src/pages/next-chats/chat/chat-box/next-multiple-chat-box.tsx@@ -18,6 +18,7 @@ import {import { MessageType } from '@/constants/chat';import {useHandleMessageInputChange,+ useRegenerateMessage,useScrollToBottom,} from '@/hooks/logic-hooks';import {@@ -27,7 +28,7 @@ import {} from '@/hooks/use-chat-request';import { useFindLlmByUuid } from '@/hooks/use-llm-request';import { useFetchUserInfo } from '@/hooks/use-user-setting-request';-import { IClientConversation } from '@/interfaces/database/chat';+import { IClientConversation, IMessage } from '@/interfaces/database/chat';import { buildMessageUuidWithRole } from '@/utils/chat';import { zodResolver } from '@hookform/resolvers/zod';import { t } from 'i18next';@@ -50,7 +51,6 @@ import {} from '../../hooks/use-button-disabled';import { useCreateConversationBeforeSendMessage } from '../../hooks/use-chat-url';import { useCreateConversationBeforeUploadDocument } from '../../hooks/use-create-conversation';-import { useSendMessage } from '../../hooks/use-send-chat-message';import {HandlePressEnterType,useSendSingleMessage,@@ -105,16 +105,20 @@ const ChatCard = forwardRef(function ChatCard(const { id: dialogId } = useParams();const { patchChat } = usePatchChat();- const { removeMessageById, derivedMessages, handlePressEnter, sendLoading } =- useSendSingleMessage({- controller,- value,- setValue,- files,- clearFiles,- });-- const { regenerateMessage } = useSendMessage(controller);+ const {+ removeMessageById,+ derivedMessages,+ handlePressEnter,+ sendLoading,+ sendMessage,+ removeMessagesAfterCurrentMessage,+ } = useSendSingleMessage({+ controller,+ value,+ setValue,+ files,+ clearFiles,+ });const messageContainerRef = useRef<HTMLDivElement>(null);@@ -131,6 +135,20 @@ const ChatCard = forwardRef(function ChatCard(const llmId = useWatch({ control: form.control, name: 'llm_id' });+ // Regenerate within this card: reuse the card's own message state and+ // resend with the card's model settings (llm_id, temperature, ...).+ const sendCardMessage = useCallback(+ ({ message, messages }: { message: IMessage; messages?: IMessage[] }) =>+ sendMessage({ message, messages, ...form.getValues() }),+ [sendMessage, form],+ );++ const { regenerateMessage } = useRegenerateMessage({+ removeMessagesAfterCurrentMessage,+ sendMessage: sendCardMessage,+ messages: derivedMessages,+ });+const { data: userInfo } = useFetchUserInfo();const { data: currentDialog } = useFetchChat();const findLlmByUuid = useFindLlmByUuid();diff --git a/web/src/pages/next-chats/hooks/use-send-single-message.ts b/web/src/pages/next-chats/hooks/use-send-single-message.tsindex abc3442401..fa6507685f 100644--- a/web/src/pages/next-chats/hooks/use-send-single-message.ts+++ b/web/src/pages/next-chats/hooks/use-send-single-message.ts@@ -157,6 +157,7 @@ export function useSendSingleMessage({removeMessageById,removeMessagesAfterCurrentMessage,handlePressEnter,+ sendMessage,sendLoading: !done,};}