diff --git a/frontend/src/assets/document.svg b/frontend/src/assets/document.svg new file mode 100644 index 00000000..bf9504c8 --- /dev/null +++ b/frontend/src/assets/document.svg @@ -0,0 +1,3 @@ + + + diff --git a/frontend/src/conversation/ConversationBubble.tsx b/frontend/src/conversation/ConversationBubble.tsx index 8f8c0ef0..9c2aac9e 100644 --- a/frontend/src/conversation/ConversationBubble.tsx +++ b/frontend/src/conversation/ConversationBubble.tsx @@ -7,7 +7,9 @@ import remarkGfm from 'remark-gfm'; import Alert from '../assets/alert.svg'; import DocsGPT3 from '../assets/cute_docsgpt3.svg'; import Dislike from '../assets/dislike.svg?react'; +import Document from '../assets/document.svg'; import Like from '../assets/like.svg?react'; +import Link from '../assets/link.svg'; import Sources from '../assets/sources.svg'; import Avatar from '../components/Avatar'; import CopyButton from '../components/CopyButton'; @@ -32,14 +34,12 @@ const ConversationBubble = forwardRef< { message, type, className, feedback, handleFeedback, sources, retryBtn }, ref, ) { - const [openSource, setOpenSource] = useState(null); - const [isLikeHovered, setIsLikeHovered] = useState(false); const [isDislikeHovered, setIsDislikeHovered] = useState(false); const [isLikeClicked, setIsLikeClicked] = useState(false); const [isDislikeClicked, setIsDislikeClicked] = useState(false); const [activeTooltip, setActiveTooltip] = useState(null); - const [isSidebarOpen, setIsSidebarOpen] = useState(false); + const [isSidebarOpen, setIsSidebarOpen] = useState(true); let bubble; if (type === 'QUESTION') { @@ -94,7 +94,7 @@ const ConversationBubble = forwardRef<
} /> -

Sources

+

Sources

{sources?.slice(0, 3)?.map((source, index) => (
setActiveTooltip(index)} onMouseOut={() => setActiveTooltip(null)} - onClick={() => - source.source && source.source !== 'local' - ? window.open( - source.source, - '_blank', - 'noopener, noreferrer', - ) - : setOpenSource(openSource === index ? null : index) - } > -

- {source.title} +

+ {source.text}

+
+ source.source && source.source !== 'local' + ? window.open( + source.source, + '_blank', + 'noopener, noreferrer', + ) + : null + } + > + Document +

+ {source.source && source.source !== 'local' + ? source.source + : source.title} +

+
{activeTooltip === index && (
} /> -

Answer

+

Answer

{sources.sources.map((source, index) => (
-

- {`${index + 1}. ${source.title}`} -

+ +

+ {`${index + 1}. ${source.title}`} +

+ {source.source && source.source !== 'local' ? ( + Link + window.open(source.source, '_blank', 'noopener, noreferrer') + } + > + ) : null} +

{source.text}

diff --git a/frontend/src/index.css b/frontend/src/index.css index 3b78e9de..6ae4b762 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -437,7 +437,7 @@ template { .ellipsis-text { overflow: hidden; display: -webkit-box; - -webkit-line-clamp: 4; + -webkit-line-clamp: 3; -webkit-box-orient: vertical; text-overflow: ellipsis; }