import { useState } from "react"; import { IconChevron, IconQuote } from "../lib/icons"; import { highlightMatch } from "../lib/highlight"; import { EmptyState, LoadingState } from "./ui/States"; function EvidenceItem({ citation, rank, defaultOpen }) { const [open, setOpen] = useState(defaultOpen); const meta = [ citation.page != null ? `page ${citation.page}` : null, `chunk #${citation.chunk_index}`, ] .filter(Boolean) .join(" · "); return (
{open && (
{highlightMatch(citation.excerpt, citation.match_text)} {citation.score != null && ( relevance {citation.score} )}
)}
); } export default function EvidencePanel({ citations, loading }) { return (

Evidence

{citations?.length > 0 && ( {citations.length} sources )}
{loading ? (
) : citations && citations.length > 0 ? ( citations.map((c, i) => ( )) ) : ( }> Ask a question — the source passages behind each answer appear here. )}
); }