diff --git a/frontend/src/conversation/Conversation.tsx b/frontend/src/conversation/Conversation.tsx index ccdbf119..9f54ddbd 100644 --- a/frontend/src/conversation/Conversation.tsx +++ b/frontend/src/conversation/Conversation.tsx @@ -1,7 +1,6 @@ import { useCallback, useEffect, useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useDispatch, useSelector } from 'react-redux'; -import { useNavigate } from 'react-router-dom'; import { useDropzone } from 'react-dropzone'; import DragFileUpload from '../assets/DragFileUpload.svg'; import newChatIcon from '../assets/openNewChat.svg'; @@ -29,11 +28,9 @@ import MessageInput from '../components/MessageInput'; export default function Conversation() { const queries = useSelector(selectQueries); - const navigate = useNavigate(); const status = useSelector(selectStatus); const conversationId = useSelector(selectConversationId); const dispatch = useDispatch(); - const inputRef = useRef(null); const [input, setInput] = useState(''); const fetchStream = useRef(null); const [lastQueryReturnedErr, setLastQueryReturnedErr] = useState(false); diff --git a/frontend/src/conversation/SharedConversation.tsx b/frontend/src/conversation/SharedConversation.tsx index 107ecb81..993556e4 100644 --- a/frontend/src/conversation/SharedConversation.tsx +++ b/frontend/src/conversation/SharedConversation.tsx @@ -1,4 +1,4 @@ -import { useEffect, useRef, useState } from 'react'; +import { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useNavigate, useParams } from 'react-router-dom'; import ConversationMessages from './ConversationMessages'; @@ -37,23 +37,13 @@ export const SharedConversation = () => { const status = useSelector(selectStatus); const [input, setInput] = useState(''); - const sharedConversationRef = useRef(null); const { t } = useTranslation(); const dispatch = useDispatch(); const [lastQueryReturnedErr, setLastQueryReturnedErr] = useState(false); - const [eventInterrupt, setEventInterrupt] = useState(false); - - useEffect(() => { - !eventInterrupt && scrollIntoView(); - }, [queries.length, queries[queries.length - 1]]); useEffect(() => { identifier && dispatch(setIdentifier(identifier)); - const element = document.getElementById('inputbox') as HTMLInputElement; - if (element) { - element.focus(); - } }, []); useEffect(() => { @@ -63,20 +53,6 @@ export const SharedConversation = () => { } }, [queries[queries.length - 1]]); - const scrollIntoView = () => { - if (!sharedConversationRef?.current || eventInterrupt) return; - - if (status === 'idle' || !queries[queries.length - 1].response) { - sharedConversationRef.current.scrollTo({ - behavior: 'smooth', - top: sharedConversationRef.current.scrollHeight, - }); - } else { - sharedConversationRef.current.scrollTop = - sharedConversationRef.current.scrollHeight; - } - }; - const fetchQueries = () => { identifier && conversationService @@ -133,7 +109,6 @@ export const SharedConversation = () => { }) => { question = question.trim(); if (question === '') return; - setEventInterrupt(false); !isRetry && dispatch(addQuery({ prompt: question })); //dispatch only new queries dispatch(fetchSharedAnswer({ question })); };