mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Fix: Fixed the issue where the agent's chat box could not automatically scroll to the bottom #3221 (#9219)
### What problem does this PR solve? Fix: Fixed the issue where the agent's chat box could not automatically scroll to the bottom #3221 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
import MessageItem from '@/components/message-item';
|
||||
import { MessageType } from '@/constants/chat';
|
||||
import { Flex, Spin } from 'antd';
|
||||
import { useRef } from 'react';
|
||||
import {
|
||||
useCreateConversationBeforeUploadDocument,
|
||||
useGetFileIcon,
|
||||
@ -19,7 +18,6 @@ import {
|
||||
useFetchNextDialog,
|
||||
useGetChatSearchParams,
|
||||
} from '@/hooks/chat-hooks';
|
||||
import { useScrollToBottom } from '@/hooks/logic-hooks';
|
||||
import { useFetchUserInfo } from '@/hooks/user-setting-hooks';
|
||||
import { buildMessageUuidWithRole } from '@/utils/chat';
|
||||
import { memo } from 'react';
|
||||
@ -34,10 +32,10 @@ const ChatContainer = ({ controller }: IProps) => {
|
||||
const { data: conversation } = useFetchNextConversation();
|
||||
const { data: currentDialog } = useFetchNextDialog();
|
||||
|
||||
const messageContainerRef = useRef<HTMLDivElement>(null);
|
||||
const {
|
||||
value,
|
||||
ref,
|
||||
scrollRef,
|
||||
messageContainerRef,
|
||||
loading,
|
||||
sendLoading,
|
||||
derivedMessages,
|
||||
@ -47,10 +45,6 @@ const ChatContainer = ({ controller }: IProps) => {
|
||||
removeMessageById,
|
||||
stopOutputMessage,
|
||||
} = useSendNextMessage(controller);
|
||||
const { scrollRef, isAtBottom, scrollToBottom } = useScrollToBottom(
|
||||
derivedMessages,
|
||||
messageContainerRef,
|
||||
);
|
||||
|
||||
const { visible, hideModal, documentId, selectedChunk, clickDocumentButton } =
|
||||
useClickDrawer();
|
||||
@ -61,11 +55,6 @@ const ChatContainer = ({ controller }: IProps) => {
|
||||
const { createConversationBeforeUploadDocument } =
|
||||
useCreateConversationBeforeUploadDocument();
|
||||
|
||||
const handleSend = (msg) => {
|
||||
// your send logic
|
||||
setTimeout(scrollToBottom, 0);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Flex flex={1} className={styles.chatContainer} vertical>
|
||||
|
||||
Reference in New Issue
Block a user