diff --git a/frontend/src/conversation/ConversationBubble.tsx b/frontend/src/conversation/ConversationBubble.tsx index 6cb97f40..6ad877c3 100644 --- a/frontend/src/conversation/ConversationBubble.tsx +++ b/frontend/src/conversation/ConversationBubble.tsx @@ -15,6 +15,10 @@ import Sources from '../assets/sources.svg'; import Avatar from '../components/Avatar'; import CopyButton from '../components/CopyButton'; import Sidebar from '../components/Sidebar'; +import { + selectChunks, + selectSelectedDocs, +} from '../preferences/preferenceSlice'; import classes from './ConversationBubble.module.css'; import { FEEDBACK, MESSAGE_TYPE } from './conversationModels'; @@ -35,6 +39,8 @@ const ConversationBubble = forwardRef< { message, type, className, feedback, handleFeedback, sources, retryBtn }, ref, ) { + const chunks = useSelector(selectChunks); + const selectedDocs = useSelector(selectSelectedDocs); const [isLikeHovered, setIsLikeHovered] = useState(false); const [isDislikeHovered, setIsDislikeHovered] = useState(false); const [isLikeClicked, setIsLikeClicked] = useState(false); @@ -63,9 +69,9 @@ const ConversationBubble = forwardRef< {DisableSourceFE || type === 'ERROR' || sources?.length === 0 || - sources?.some( - (source) => source.source === 'None', - ) ? null : !sources ? ( + sources?.some((source) => source.source === 'None') ? null : !sources && + chunks !== '0' && + selectedDocs ? (
Sources
-- {source.text} -
+ sources && ( +Sources
+- {source.source && source.source !== 'local' - ? source.source - : source.title} -
-+
{source.text}
++ {source.source && source.source !== 'local' + ? source.source + : source.title} +
+{`View ${ - sources?.length ? sources.length - 3 : 0 - } more`}
-+ {source.text} +
+{`View ${ + sources?.length ? sources.length - 3 : 0 + } more`}
+