From bd636d59ddf6d08868b882aa69a61c69e78181cb Mon Sep 17 00:00:00 2001 From: Siddhant Rai Date: Thu, 14 Nov 2024 15:35:22 +0530 Subject: [PATCH] refactor: smooth answer appearance --- .../src/conversation/ConversationBubble.tsx | 17 +++++++----- frontend/src/index.css | 26 +++++++++++++++++++ 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/frontend/src/conversation/ConversationBubble.tsx b/frontend/src/conversation/ConversationBubble.tsx index 284c2b568..8e5df6662 100644 --- a/frontend/src/conversation/ConversationBubble.tsx +++ b/frontend/src/conversation/ConversationBubble.tsx @@ -1,12 +1,14 @@ +import 'katex/dist/katex.min.css'; + import { forwardRef, useState } from 'react'; import ReactMarkdown from 'react-markdown'; import { useSelector } from 'react-redux'; import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'; import { vscDarkPlus } from 'react-syntax-highlighter/dist/cjs/styles/prism'; +import rehypeKatex from 'rehype-katex'; import remarkGfm from 'remark-gfm'; import remarkMath from 'remark-math'; -import rehypeKatex from 'rehype-katex'; -import 'katex/dist/katex.min.css'; + import DocsGPT3 from '../assets/cute_docsgpt3.svg'; import Dislike from '../assets/dislike.svg?react'; import Document from '../assets/document.svg'; @@ -16,13 +18,13 @@ import Sources from '../assets/sources.svg'; import Avatar from '../components/Avatar'; import CopyButton from '../components/CopyButton'; import Sidebar from '../components/Sidebar'; +import SpeakButton from '../components/TextToSpeechButton'; import { selectChunks, selectSelectedDocs, } from '../preferences/preferenceSlice'; import classes from './ConversationBubble.module.css'; import { FEEDBACK, MESSAGE_TYPE } from './conversationModels'; -import SpeakButton from '../components/TextToSpeechButton'; const DisableSourceFE = import.meta.env.VITE_DISABLE_SOURCE_FE || false; @@ -41,6 +43,7 @@ const ConversationBubble = forwardRef< { message, type, className, feedback, handleFeedback, sources, retryBtn }, ref, ) { + // const bubbleRef = useRef(null); const chunks = useSelector(selectChunks); const selectedDocs = useSelector(selectSelectedDocs); const [isLikeHovered, setIsLikeHovered] = useState(false); @@ -141,7 +144,7 @@ const ConversationBubble = forwardRef< />

Sources

-
+
{sources?.slice(0, 3)?.map((source, index) => (
@@ -190,7 +193,7 @@ const ConversationBubble = forwardRef<
{activeTooltip === index && (
setActiveTooltip(index)} onMouseOut={() => setActiveTooltip(null)} > @@ -231,14 +234,14 @@ const ConversationBubble = forwardRef<

Answer