diff --git a/frontend/src/conversation/ConversationBubble.tsx b/frontend/src/conversation/ConversationBubble.tsx index 4d657950..1f1d6c0d 100644 --- a/frontend/src/conversation/ConversationBubble.tsx +++ b/frontend/src/conversation/ConversationBubble.tsx @@ -649,50 +649,68 @@ const ConversationBubble = forwardRef< }); type AllSourcesProps = { - sources: { title: string; text: string; source: string }[]; + sources: { title: string; text: string; link?: string }[]; }; function AllSources(sources: AllSourcesProps) { + const { t } = useTranslation(); + + const handleCardClick = (link: string) => { + if (link && link !== 'local') { + window.open(link, '_blank', 'noopener,noreferrer'); + } + }; + return (
-

{`${sources.sources.length} Sources`}

+

{`${sources.sources.length} ${t('conversation.sources.title')}`}

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

- {`${index + 1}. ${source.title}`} + {sources.sources.map((source, index) => { + const isExternalSource = source.link && source.link !== 'local'; + return ( +

+ isExternalSource && source.link && handleCardClick(source.link) + } + > + {isExternalSource && ( +
+ External Link +
+ )} + +

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

+
+

+ {source.text}

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

- {source.text} -

-
- ))} +
+ ); + })}
); } - export default ConversationBubble; function ToolCalls({ toolCalls }: { toolCalls: ToolCallsType[] }) {