"use client"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; import { HelpTip } from "@/components/ui/help-tip"; import { MentorAskResponse } from "@/types"; import { RAGCitationCard } from "./rag-citation-card"; import { Markdown } from "@/components/ui/markdown"; import { Skeleton } from "@/components/ui/skeleton"; import { Brain, BookOpen, MessageSquareText, Sparkles, AlertCircle, Lightbulb, BarChart3, MessageCircleQuestion, User, BookMarked, } from "lucide-react"; interface MentorAnswerDisplayProps { response: MentorAskResponse | null; isLoading: boolean; question: string | null; error?: string | null; onFollowUp?: (question: string) => void; } export function MentorAnswerDisplay({ response, isLoading, question, error, onFollowUp, }: MentorAnswerDisplayProps) { if (isLoading) { return (
); } if (!response && !question && !error) { return (

AI Mentor

Your personalized AI mentor that knows your role and past experiences. Ask questions about standards, workflows, or get guidance on your tasks.

Role-aware Personal context Follow-ups
); } if (error) { return (
{question && (

{question}

)} Mentor Query Failed

{error}

); } if (!response) { return null; } // Calculate total sources searched const totalSearched = response.search_stats ? Object.values(response.search_stats).reduce( (sum, count) => sum + (count > 0 ? count : 0), 0, ) : 0; return (
{/* Question */}

{question}

{/* Personalization Context - What makes this different from Ask AI */} {(response.agent_role || response.journal_entries_used) && (
{response.agent_role && ( Role: {response.agent_role} {response.agent_team && ( ({response.agent_team}) )} )} {response.journal_entries_used !== undefined && response.journal_entries_used > 0 && ( {response.journal_entries_used} personal journal {response.journal_entries_used !== 1 ? "s" : ""} used )}
)} {/* Answer */} Mentor Response {response.sources.length} sources used
{response.answer}
{/* Suggested Follow-ups */} {response.suggested_followups && response.suggested_followups.length > 0 && (
Follow-up Questions
{response.suggested_followups.map((followup, index) => ( ))}
)} {/* Search Stats */} {response.search_stats && Object.keys(response.search_stats).length > 0 && (
Search Stats ({totalSearched} total results)
{Object.entries(response.search_stats).map( ([indexType, count]) => ( 0 ? "secondary" : "outline"} className={`text-xs ${count === -1 ? "text-red-500" : ""}`} > {indexType}: {count === -1 ? "error" : count} ), )}
)} {/* Citations */} {response.sources.length > 0 && (
Sources ({response.sources.length})
{response.sources.map((source, index) => ( ))}
)}
); }