mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-01 21:37:33 +08:00
Fix: multiple model chat pass-in session_id, and do not save session. (#17581)
This commit is contained in:
@@ -26,7 +26,8 @@ import { AudioButton } from '../ui/audio-button';
|
||||
export type NextMessageInputOnPressEnterParameter = {
|
||||
enableThinking?: string;
|
||||
enableInternet?: boolean;
|
||||
store_history_messages?: boolean;
|
||||
storeHistoryMessages?: boolean;
|
||||
omitSessionId?: boolean;
|
||||
};
|
||||
|
||||
interface NextMessageInputProps {
|
||||
|
||||
@@ -50,7 +50,6 @@ import {
|
||||
useGetSendButtonDisabled,
|
||||
useSendButtonDisabled,
|
||||
} from '../../hooks/use-button-disabled';
|
||||
import { useCreateConversationBeforeSendMessage } from '../../hooks/use-chat-url';
|
||||
import { useCreateConversationBeforeUploadDocument } from '../../hooks/use-create-conversation';
|
||||
import {
|
||||
HandlePressEnterType,
|
||||
@@ -139,7 +138,7 @@ const ChatCard = forwardRef(function ChatCard(
|
||||
// resend with the card's model settings (llm_id, temperature, ...).
|
||||
const sendCardMessage = useCallback(
|
||||
({ message, messages }: { message: IMessage; messages?: IMessage[] }) =>
|
||||
sendMessage({ message, messages, ...form.getValues(), store_history_messages: false }),
|
||||
sendMessage({ message, messages, ...form.getValues(), storeHistoryMessages: false, omitSessionId: true }),
|
||||
[sendMessage, form],
|
||||
);
|
||||
|
||||
@@ -182,7 +181,7 @@ const ChatCard = forwardRef(function ChatCard(
|
||||
useImperativeHandle(
|
||||
ref,
|
||||
(): HandlePressEnterType => (params) =>
|
||||
handlePressEnter({ ...params, ...form.getValues(), store_history_messages: false }),
|
||||
handlePressEnter({ ...params, ...form.getValues(), storeHistoryMessages: false, omitSessionId: true }),
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -279,6 +278,7 @@ const ChatCard = forwardRef(function ChatCard(
|
||||
regenerateMessage={regenerateMessage}
|
||||
sendLoading={sendLoading}
|
||||
clickDocumentButton={clickDocumentButton}
|
||||
showLikeButton={false}
|
||||
></MessageItem>
|
||||
);
|
||||
})}
|
||||
@@ -298,9 +298,6 @@ export function MultipleChatBox({
|
||||
stopOutputMessage,
|
||||
conversation,
|
||||
}: MultipleChatBoxProps) {
|
||||
const { createConversationBeforeSendMessage } =
|
||||
useCreateConversationBeforeSendMessage();
|
||||
|
||||
const { createConversationBeforeUploadDocument } =
|
||||
useCreateConversationBeforeUploadDocument();
|
||||
const { conversationId } = useGetChatSearchParams();
|
||||
@@ -342,21 +339,14 @@ export function MultipleChatBox({
|
||||
}: NextMessageInputOnPressEnterParameter) => {
|
||||
if (trim(value) === '') return;
|
||||
|
||||
const data = await createConversationBeforeSendMessage(value);
|
||||
|
||||
if (data === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
Object.values(boxesRef.current).forEach((box) => {
|
||||
box?.({
|
||||
enableInternet,
|
||||
enableThinking,
|
||||
...data,
|
||||
});
|
||||
});
|
||||
},
|
||||
[createConversationBeforeSendMessage, value],
|
||||
[value],
|
||||
);
|
||||
|
||||
return (
|
||||
|
||||
@@ -60,6 +60,8 @@ export function useSendSingleMessage({
|
||||
messages,
|
||||
enableInternet,
|
||||
enableThinking,
|
||||
storeHistoryMessages,
|
||||
omitSessionId,
|
||||
...params
|
||||
}: {
|
||||
message: IMessage;
|
||||
@@ -71,7 +73,7 @@ export function useSendSingleMessage({
|
||||
api.completionUrl,
|
||||
{
|
||||
chat_id: chatId,
|
||||
session_id: sessionId,
|
||||
...(omitSessionId ? {} : { session_id: sessionId }),
|
||||
messages: [
|
||||
...(Array.isArray(messages) && messages?.length > 0
|
||||
? messages
|
||||
@@ -81,6 +83,9 @@ export function useSendSingleMessage({
|
||||
reasoning: Number(enableThinking),
|
||||
internet: enableInternet,
|
||||
...params,
|
||||
...(storeHistoryMessages === undefined
|
||||
? {}
|
||||
: { store_history_messages: storeHistoryMessages }),
|
||||
pass_all_history_messages: true,
|
||||
},
|
||||
controller,
|
||||
@@ -112,7 +117,7 @@ export function useSendSingleMessage({
|
||||
targetConversationId,
|
||||
...params
|
||||
}: NextMessageInputOnPressEnterParameter &
|
||||
CreateConversationBeforeSendMessageReturnType) => {
|
||||
Partial<NonNullable<CreateConversationBeforeSendMessageReturnType>>) => {
|
||||
if (trim(value) === '' || !done) return;
|
||||
const id = uuid();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user