import Trash from '../assets/trash.svg'; import Arrow2 from '../assets/dropdown-arrow.svg'; import { Doc } from '../preferences/preferenceApi'; import { useDispatch } from 'react-redux'; type Props = { options: Doc[] | null; selectedDocs: Doc | null; setSelectedDocs: any; isDocsListOpen: boolean; setIsDocsListOpen: React.Dispatch>; handleDeleteClick: any; }; function SourceDropdown({ options, setSelectedDocs, selectedDocs, setIsDocsListOpen, isDocsListOpen, handleDeleteClick, }: Props) { const dispatch = useDispatch(); const embeddingsName = import.meta.env.VITE_EMBEDDINGS_NAME || 'huggingface_sentence-transformers/all-mpnet-base-v2'; const handleEmptyDocumentSelect = () => { dispatch(setSelectedDocs(null)); setIsDocsListOpen(false); }; return (
{isDocsListOpen && (
{options ? ( options.map((option: any, index: number) => { if (option.model === embeddingsName) { return (
{ dispatch(setSelectedDocs(option)); setIsDocsListOpen(false); }} > { setIsDocsListOpen(false); }} className="ml-4 flex-1 overflow-hidden overflow-ellipsis whitespace-nowrap py-3" > {option.name} {option.location === 'local' && ( Delete { event.stopPropagation(); handleDeleteClick(index, option); }} /> )}
); } }) ) : (

No default documentation.

)}
Empty
)}
); } export default SourceDropdown;