mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? Fix: Fixed the issue with external chat box reporting errors #3909 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import MessageInput from '@/components/message-input';
|
||||
import MessageItem from '@/components/message-item';
|
||||
import { useClickDrawer } from '@/components/pdf-drawer/hooks';
|
||||
import { MessageType } from '@/constants/chat';
|
||||
import { MessageType, SharedFrom } from '@/constants/chat';
|
||||
import { useSendButtonDisabled } from '@/pages/chat/hooks';
|
||||
import { Flex, Spin } from 'antd';
|
||||
import { forwardRef, useMemo } from 'react';
|
||||
@ -17,7 +17,7 @@ import { useFetchFlowSSE } from '@/hooks/flow-hooks';
|
||||
import styles from './index.less';
|
||||
|
||||
const ChatContainer = () => {
|
||||
const { sharedId: conversationId } = useGetSharedChatSearchParams();
|
||||
const { sharedId: conversationId, from } = useGetSharedChatSearchParams();
|
||||
const { visible, hideModal, documentId, selectedChunk, clickDocumentButton } =
|
||||
useClickDrawer();
|
||||
|
||||
@ -32,14 +32,14 @@ const ChatContainer = () => {
|
||||
hasError,
|
||||
} = useSendSharedMessage();
|
||||
const sendDisabled = useSendButtonDisabled(value);
|
||||
const useData = (from: SharedFrom) =>
|
||||
useMemo(() => {
|
||||
return from === SharedFrom.Agent
|
||||
? useFetchFlowSSE
|
||||
: useFetchNextConversationSSE;
|
||||
}, [from]);
|
||||
|
||||
const { data: InforForm } = useData(from)();
|
||||
const useFetchAvatar = useMemo(() => {
|
||||
return from === SharedFrom.Agent
|
||||
? useFetchFlowSSE
|
||||
: useFetchNextConversationSSE;
|
||||
}, [from]);
|
||||
|
||||
const { data: avatarData } = useFetchAvatar();
|
||||
|
||||
if (!conversationId) {
|
||||
return <div>empty</div>;
|
||||
@ -55,7 +55,7 @@ const ChatContainer = () => {
|
||||
return (
|
||||
<MessageItem
|
||||
key={message.id}
|
||||
avatardialog={InforForm?.avatar}
|
||||
avatardialog={avatarData?.avatar}
|
||||
item={message}
|
||||
nickname="You"
|
||||
reference={buildMessageItemReference(
|
||||
@ -72,6 +72,8 @@ const ChatContainer = () => {
|
||||
}
|
||||
index={i}
|
||||
clickDocumentButton={clickDocumentButton}
|
||||
showLikeButton={false}
|
||||
showLoudspeaker={false}
|
||||
></MessageItem>
|
||||
);
|
||||
})}
|
||||
|
||||
Reference in New Issue
Block a user