diff --git a/demo/website/src/components/chat/Message.tsx b/demo/website/src/components/chat/Message.tsx
index bb7d13d3..f524d984 100644
--- a/demo/website/src/components/chat/Message.tsx
+++ b/demo/website/src/components/chat/Message.tsx
@@ -90,13 +90,15 @@ export function MessageSources({ chatId, messageId }: MessageSourcesProps) {
) : (
sourcesRequest.data &&
- sourcesRequest.data.length > 0 && (
+ (sourcesRequest.data.length ? (
{sourcesRequest.data.map((source) => (
))}
- )
+ ) : (
+ "No sources available"
+ ))
)}
);
@@ -106,14 +108,18 @@ function SourcePopover(props: { chatId: string; messageId: string }) {
const [visible, setVisible] = useState(false);
return (
<>
- setVisible(false)}
- visible={visible}
- size="large"
- header="Sources"
- >
-
-
+ {/* Lazy load sources */}
+ {visible && (
+ setVisible(false)}
+ visible
+ size="large"
+ header="Sources"
+ >
+
+
+ )}
+