'use client'; import { FileText } from 'lucide-react'; import type { RagQueryResponse, RagCitation } from '../../hooks/use-rag'; import { RagFallbackBadge } from './rag-fallback-badge'; interface RagResultCardProps { result: RagQueryResponse; } function ConfidenceBar({ score }: { score: number }) { const pct = Math.round(score * 100); const color = pct >= 80 ? 'bg-green-500' : pct >= 50 ? 'bg-yellow-500' : 'bg-red-500'; return (
{pct}%
); } function CitationItem({ citation }: { citation: RagCitation }) { return (
{citation.docType} {citation.docNumber && ( — {citation.docNumber} )} {citation.revision && ( Rev. {citation.revision} )}

{citation.snippet}

); } export function RagResultCard({ result }: RagResultCardProps) { return (

คำตอบ

{result.answer}

{result.usedFallbackModel && }
{result.citations.length > 0 && (

อ้างอิง ({result.citations.length} เอกสาร)

{result.citations.map((c) => ( ))}
)}
); }