import React from "react"; import { ExampleTrace } from "@/types"; import { Dialog, DialogContent } from "@/components/ui/dialog"; import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; import { AlertTriangle, CheckCircle, Target, User } from "lucide-react"; interface Props { open: boolean; example: ExampleTrace; onOpenChange: (open: boolean) => void; onImport: () => void; } const ExampleTraceDetailModal: React.FC = ({ open, example, onOpenChange, onImport, }) => { return ( {/* Correctness Status */}
{example.is_correct && (
Correct Response
)}
{/* Question */}

Full Question

{example.question}

{/* Agents */} {example.agents && example.agents.length > 0 && (

Agents Involved

{example.agents.map((a) => ( {a} {a === example.mistake_agent && " ⚠️"} ))}
)} {/* Failure Analysis Section */} {!example.is_correct && (

Failure Analysis

{/* Mistake Reason - The key insight field! */} {example.mistake_reason && (

Why This Failed:

{example.mistake_reason}

)} {/* Mistake Agent */} {example.mistake_agent && (
Agent that made the mistake: {example.mistake_agent}
)} {/* Ground Truth */} {example.ground_truth && (

Correct Answer:

{example.ground_truth}

)}
)} {/* Trace Preview */} {example.trace && (

Trace Preview

              {(() => {
                try {
                  const obj = JSON.parse(example.trace);
                  return JSON.stringify(obj, null, 2);
                } catch {
                  return example.trace;
                }
              })()}
            
)} {/* Footer */}
); }; export default ExampleTraceDetailModal;