mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-05-24 23:28:47 +08:00
### What problem does this PR solve? fix: new message appears in wrong chat window. #1289 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
4df75ca84e
commit
06fd35d420
@ -214,7 +214,7 @@ export const useSendMessageWithSse = (
|
|||||||
[url],
|
[url],
|
||||||
);
|
);
|
||||||
|
|
||||||
return { send, answer, done };
|
return { send, answer, done, setDone };
|
||||||
};
|
};
|
||||||
|
|
||||||
//#region chat hooks
|
//#region chat hooks
|
@ -8,7 +8,7 @@ import { useCallback, useMemo } from 'react';
|
|||||||
import { useLocation } from 'umi';
|
import { useLocation } from 'umi';
|
||||||
import Toolbar from '../right-toolbar';
|
import Toolbar from '../right-toolbar';
|
||||||
|
|
||||||
import { useFetchAppConf } from '@/hooks/logicHooks';
|
import { useFetchAppConf } from '@/hooks/logic-hooks';
|
||||||
import { MessageOutlined } from '@ant-design/icons';
|
import { MessageOutlined } from '@ant-design/icons';
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import React from 'react';
|
|||||||
import User from '../user';
|
import User from '../user';
|
||||||
|
|
||||||
import { LanguageList } from '@/constants/common';
|
import { LanguageList } from '@/constants/common';
|
||||||
import { useChangeLanguage } from '@/hooks/logicHooks';
|
import { useChangeLanguage } from '@/hooks/logic-hooks';
|
||||||
import { useSelector } from 'umi';
|
import { useSelector } from 'umi';
|
||||||
import styled from './index.less';
|
import styled from './index.less';
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
useChangeDocumentParser,
|
useChangeDocumentParser,
|
||||||
useSetSelectedRecord,
|
useSetSelectedRecord,
|
||||||
} from '@/hooks/logicHooks';
|
} from '@/hooks/logic-hooks';
|
||||||
import { useFetchTenantInfo } from '@/hooks/userSettingHook';
|
import { useFetchTenantInfo } from '@/hooks/userSettingHook';
|
||||||
import { IKnowledgeFile } from '@/interfaces/database/knowledge';
|
import { IKnowledgeFile } from '@/interfaces/database/knowledge';
|
||||||
import { getExtension, isFileUploadDone } from '@/utils/documentUtils';
|
import { getExtension, isFileUploadDone } from '@/utils/documentUtils';
|
||||||
|
@ -4,7 +4,7 @@ import {
|
|||||||
useSelectDocumentList,
|
useSelectDocumentList,
|
||||||
useSetDocumentStatus,
|
useSetDocumentStatus,
|
||||||
} from '@/hooks/documentHooks';
|
} from '@/hooks/documentHooks';
|
||||||
import { useSetSelectedRecord } from '@/hooks/logicHooks';
|
import { useSetSelectedRecord } from '@/hooks/logic-hooks';
|
||||||
import { useSelectParserList } from '@/hooks/userSettingHook';
|
import { useSelectParserList } from '@/hooks/userSettingHook';
|
||||||
import { IKnowledgeFile } from '@/interfaces/database/knowledge';
|
import { IKnowledgeFile } from '@/interfaces/database/knowledge';
|
||||||
import { getExtension } from '@/utils/documentUtils';
|
import { getExtension } from '@/utils/documentUtils';
|
||||||
@ -12,7 +12,6 @@ import { Divider, Flex, Switch, Table, Typography } from 'antd';
|
|||||||
import type { ColumnsType } from 'antd/es/table';
|
import type { ColumnsType } from 'antd/es/table';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import CreateFileModal from './create-file-modal';
|
import CreateFileModal from './create-file-modal';
|
||||||
import WebCrawlModal from './web-crawl-modal';
|
|
||||||
import DocumentToolbar from './document-toolbar';
|
import DocumentToolbar from './document-toolbar';
|
||||||
import {
|
import {
|
||||||
useChangeDocumentParser,
|
useChangeDocumentParser,
|
||||||
@ -20,13 +19,15 @@ import {
|
|||||||
useFetchDocumentListOnMount,
|
useFetchDocumentListOnMount,
|
||||||
useGetPagination,
|
useGetPagination,
|
||||||
useGetRowSelection,
|
useGetRowSelection,
|
||||||
useHandleUploadDocument, useHandleWebCrawl,
|
useHandleUploadDocument,
|
||||||
|
useHandleWebCrawl,
|
||||||
useNavigateToOtherPage,
|
useNavigateToOtherPage,
|
||||||
useRenameDocument,
|
useRenameDocument,
|
||||||
} from './hooks';
|
} from './hooks';
|
||||||
import ParsingActionCell from './parsing-action-cell';
|
import ParsingActionCell from './parsing-action-cell';
|
||||||
import ParsingStatusCell from './parsing-status-cell';
|
import ParsingStatusCell from './parsing-status-cell';
|
||||||
import RenameModal from './rename-modal';
|
import RenameModal from './rename-modal';
|
||||||
|
import WebCrawlModal from './web-crawl-modal';
|
||||||
|
|
||||||
import FileUploadModal from '@/components/file-upload-modal';
|
import FileUploadModal from '@/components/file-upload-modal';
|
||||||
import { formatDate } from '@/utils/date';
|
import { formatDate } from '@/utils/date';
|
||||||
|
@ -15,7 +15,10 @@ import ModelSetting from './model-setting';
|
|||||||
import PromptEngine from './prompt-engine';
|
import PromptEngine from './prompt-engine';
|
||||||
|
|
||||||
import { useTranslate } from '@/hooks/commonHooks';
|
import { useTranslate } from '@/hooks/commonHooks';
|
||||||
import { useFetchLlmModelOnVisible, useFetchModelId } from '@/hooks/logicHooks';
|
import {
|
||||||
|
useFetchLlmModelOnVisible,
|
||||||
|
useFetchModelId,
|
||||||
|
} from '@/hooks/logic-hooks';
|
||||||
import { getBase64FromUploadFileList } from '@/utils/fileUtil';
|
import { getBase64FromUploadFileList } from '@/utils/fileUtil';
|
||||||
import { removeUselessFieldsFromValues } from '@/utils/form';
|
import { removeUselessFieldsFromValues } from '@/utils/form';
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
|
@ -23,7 +23,7 @@ import {
|
|||||||
useShowDeleteConfirm,
|
useShowDeleteConfirm,
|
||||||
useTranslate,
|
useTranslate,
|
||||||
} from '@/hooks/commonHooks';
|
} from '@/hooks/commonHooks';
|
||||||
import { useSendMessageWithSse } from '@/hooks/logicHooks';
|
import { useSendMessageWithSse } from '@/hooks/logic-hooks';
|
||||||
import { useOneNamespaceEffectsLoading } from '@/hooks/storeHooks';
|
import { useOneNamespaceEffectsLoading } from '@/hooks/storeHooks';
|
||||||
import {
|
import {
|
||||||
IAnswer,
|
IAnswer,
|
||||||
@ -552,7 +552,7 @@ export const useSendMessage = (
|
|||||||
const { handleInputChange, value, setValue } = useHandleMessageInputChange();
|
const { handleInputChange, value, setValue } = useHandleMessageInputChange();
|
||||||
|
|
||||||
const { handleClickConversation } = useClickConversationCard();
|
const { handleClickConversation } = useClickConversationCard();
|
||||||
const { send, answer, done } = useSendMessageWithSse();
|
const { send, answer, done, setDone } = useSendMessageWithSse();
|
||||||
|
|
||||||
const sendMessage = useCallback(
|
const sendMessage = useCallback(
|
||||||
async (message: string, id?: string) => {
|
async (message: string, id?: string) => {
|
||||||
@ -609,11 +609,19 @@ export const useSendMessage = (
|
|||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
// #1289
|
||||||
if (answer.answer && answer?.conversationId === conversationId) {
|
if (answer.answer && answer?.conversationId === conversationId) {
|
||||||
addNewestAnswer(answer);
|
addNewestAnswer(answer);
|
||||||
}
|
}
|
||||||
}, [answer, addNewestAnswer, conversationId]);
|
}, [answer, addNewestAnswer, conversationId]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// #1289 switch to another conversion window when the last conversion answer doesn't finish.
|
||||||
|
if (conversationId) {
|
||||||
|
setDone(true);
|
||||||
|
}
|
||||||
|
}, [setDone, conversationId]);
|
||||||
|
|
||||||
const handlePressEnter = useCallback(() => {
|
const handlePressEnter = useCallback(() => {
|
||||||
if (trim(value) === '') return;
|
if (trim(value) === '') return;
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ import {
|
|||||||
} from './hooks';
|
} from './hooks';
|
||||||
|
|
||||||
import { useSetModalState, useTranslate } from '@/hooks/commonHooks';
|
import { useSetModalState, useTranslate } from '@/hooks/commonHooks';
|
||||||
import { useSetSelectedRecord } from '@/hooks/logicHooks';
|
import { useSetSelectedRecord } from '@/hooks/logic-hooks';
|
||||||
import { IDialog } from '@/interfaces/database/chat';
|
import { IDialog } from '@/interfaces/database/chat';
|
||||||
import ChatOverviewModal from './chat-overview-modal';
|
import ChatOverviewModal from './chat-overview-modal';
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
|
@ -3,7 +3,7 @@ import {
|
|||||||
useCreateSharedConversation,
|
useCreateSharedConversation,
|
||||||
useFetchSharedConversation,
|
useFetchSharedConversation,
|
||||||
} from '@/hooks/chatHooks';
|
} from '@/hooks/chatHooks';
|
||||||
import { useSendMessageWithSse } from '@/hooks/logicHooks';
|
import { useSendMessageWithSse } from '@/hooks/logic-hooks';
|
||||||
import { useOneNamespaceEffectsLoading } from '@/hooks/storeHooks';
|
import { useOneNamespaceEffectsLoading } from '@/hooks/storeHooks';
|
||||||
import { IAnswer } from '@/interfaces/database/chat';
|
import { IAnswer } from '@/interfaces/database/chat';
|
||||||
import api from '@/utils/api';
|
import api from '@/utils/api';
|
||||||
|
@ -10,7 +10,7 @@ import {
|
|||||||
useSelectParentFolderList,
|
useSelectParentFolderList,
|
||||||
useUploadFile,
|
useUploadFile,
|
||||||
} from '@/hooks/fileManagerHooks';
|
} from '@/hooks/fileManagerHooks';
|
||||||
import { useGetPagination, useSetPagination } from '@/hooks/logicHooks';
|
import { useGetPagination, useSetPagination } from '@/hooks/logic-hooks';
|
||||||
import { useOneNamespaceEffectsLoading } from '@/hooks/storeHooks';
|
import { useOneNamespaceEffectsLoading } from '@/hooks/storeHooks';
|
||||||
import { IFile } from '@/interfaces/database/file-manager';
|
import { IFile } from '@/interfaces/database/file-manager';
|
||||||
import { PaginationProps } from 'antd';
|
import { PaginationProps } from 'antd';
|
||||||
|
@ -4,7 +4,7 @@ import {
|
|||||||
useHandleMessageInputChange,
|
useHandleMessageInputChange,
|
||||||
useScrollToBottom,
|
useScrollToBottom,
|
||||||
useSendMessageWithSse,
|
useSendMessageWithSse,
|
||||||
} from '@/hooks/logicHooks';
|
} from '@/hooks/logic-hooks';
|
||||||
import { IAnswer } from '@/interfaces/database/chat';
|
import { IAnswer } from '@/interfaces/database/chat';
|
||||||
import { IMessage } from '@/pages/chat/interface';
|
import { IMessage } from '@/pages/chat/interface';
|
||||||
import api from '@/utils/api';
|
import api from '@/utils/api';
|
||||||
|
@ -18,7 +18,7 @@ import {
|
|||||||
ModelVariableType,
|
ModelVariableType,
|
||||||
settledModelVariableMap,
|
settledModelVariableMap,
|
||||||
} from '@/constants/knowledge';
|
} from '@/constants/knowledge';
|
||||||
import { useFetchModelId, useSendMessageWithSse } from '@/hooks/logicHooks';
|
import { useFetchModelId, useSendMessageWithSse } from '@/hooks/logic-hooks';
|
||||||
import { Variable } from '@/interfaces/database/chat';
|
import { Variable } from '@/interfaces/database/chat';
|
||||||
import api from '@/utils/api';
|
import api from '@/utils/api';
|
||||||
import { useDebounceEffect } from 'ahooks';
|
import { useDebounceEffect } from 'ahooks';
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { IModalManagerChildrenProps } from '@/components/modal-manager';
|
import { IModalManagerChildrenProps } from '@/components/modal-manager';
|
||||||
import { useTranslate } from '@/hooks/commonHooks';
|
import { useTranslate } from '@/hooks/commonHooks';
|
||||||
import { useFetchFlowTemplates } from '@/hooks/flow-hooks';
|
import { useFetchFlowTemplates } from '@/hooks/flow-hooks';
|
||||||
import { useSelectItem } from '@/hooks/logicHooks';
|
import { useSelectItem } from '@/hooks/logic-hooks';
|
||||||
import { Card, Flex, Form, Input, Modal, Space, Typography } from 'antd';
|
import { Card, Flex, Form, Input, Modal, Space, Typography } from 'antd';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
|
@ -32,7 +32,7 @@ import {
|
|||||||
|
|
||||||
import { LanguageList } from '@/constants/common';
|
import { LanguageList } from '@/constants/common';
|
||||||
import { useTranslate } from '@/hooks/commonHooks';
|
import { useTranslate } from '@/hooks/commonHooks';
|
||||||
import { useChangeLanguage } from '@/hooks/logicHooks';
|
import { useChangeLanguage } from '@/hooks/logic-hooks';
|
||||||
import parentStyles from '../index.less';
|
import parentStyles from '../index.less';
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user