(clean:unused)

This commit is contained in:
ManishMadan2882
2025-03-16 04:07:33 +05:30
parent d6c9b4fbc9
commit adc637b689
2 changed files with 1 additions and 29 deletions

View File

@@ -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<AppDispatch>();
const inputRef = useRef<HTMLTextAreaElement>(null);
const [input, setInput] = useState('');
const fetchStream = useRef<any>(null);
const [lastQueryReturnedErr, setLastQueryReturnedErr] = useState(false);

View File

@@ -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<HTMLDivElement>(null);
const { t } = useTranslation();
const dispatch = useDispatch<AppDispatch>();
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 }));
};