/* eslint-disable @next/next/no-img-element */ import { Dialog, DialogPanel, DialogTitle, Transition, TransitionChild, } from '@headlessui/react'; import { Document } from '@langchain/core/documents'; import { File } from 'lucide-react'; import { Fragment, useState } from 'react'; const MessageSources = ({ sources }: { sources: Document[] }) => { const [isDialogOpen, setIsDialogOpen] = useState(false); const closeModal = () => { setIsDialogOpen(false); document.body.classList.remove('overflow-hidden-scrollable'); }; const openModal = () => { setIsDialogOpen(true); document.body.classList.add('overflow-hidden-scrollable'); }; return (
{sources.slice(0, 3).map((source, i) => (

{source.metadata.title}

{source.metadata.url === 'File' ? (
) : ( favicon )}

{source.metadata.url.replace(/.+\/\/|www.|\..+/g, '')}

{i + 1}
))} {sources.length > 3 && ( )}
); }; export default MessageSources;