"use client"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { RAGQueryResponse } from "@/types"; import { RAGCitationCard } from "./rag-citation-card"; import { Markdown } from "@/components/ui/markdown"; import { Skeleton } from "@/components/ui/skeleton"; import { Bot, BookOpen, MessageSquareText, Sparkles, AlertCircle, } from "lucide-react"; interface RAGAnswerDisplayProps { response: RAGQueryResponse | null; isLoading: boolean; question: string | null; error?: string | null; } export function RAGAnswerDisplay({ response, isLoading, question, error, }: RAGAnswerDisplayProps) { if (isLoading) { return (
); } if (!response && !question && !error) { return (

Ask AI

Ask questions about your codebase, documentation, or past conversations. The AI will provide answers with citations from the knowledge base.

); } if (error) { return (
{question && (

{question}

)} Query Failed

{error}

); } if (!response) { return null; } return (
{/* Question */}

{response.query}

{/* Answer */} AI Answer {response.context_used} sources used
{response.answer}
{/* Citations */} {response.citations.length > 0 && (
Citations ({response.citations.length})
{response.citations.map((citation, index) => ( ))}
)}
); }