"use client"; import { Card, CardContent } from "@/components/ui/card"; import { RAGCitation } from "@/types"; import { KBIndexTypeBadge } from "./kb-index-type-badge"; import { HelpTip } from "@/components/ui/help-tip"; import { Quote, Hash } from "lucide-react"; interface RAGCitationCardProps { citation: RAGCitation; index: number; } export function RAGCitationCard({ citation, index }: RAGCitationCardProps) { // Truncate content const snippet = citation.content.length > 200 ? citation.content.substring(0, 200) + "..." : citation.content; // Format source const formatSource = (source: string) => { if (source.includes("/")) { const parts = source.split("/"); if (parts.length > 3) { return ".../" + parts.slice(-2).join("/"); } } return source; }; const scorePercent = Math.round(citation.score * 100); return (
{index + 1}
{scorePercent}%

{formatSource(citation.source)}

{snippet}

); }