"use client"; /** * 批量测试用例详情抽屉。 * 当前展示前端 mock 数据,后续可直接替换为真实执行事件与校验结果。 */ import { CheckCircle2, Circle, Loader2, MessageSquareText, Target, TriangleAlert, } from "lucide-react"; import { BatchCaseStatusBadge } from "@/components/batch-test/batch-case-status"; import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, } from "@/components/ui/sheet"; import type { BatchRunCase } from "@/data/batch-run"; import { cn } from "@/lib/utils"; type BatchCaseDetailDrawerProps = { item: BatchRunCase | null; assistantName: string; onClose: () => void; }; export function BatchCaseDetailDrawer({ item, assistantName, onClose, }: BatchCaseDetailDrawerProps) { return ( { if (!open) onClose(); }} > {item && ( <>

用例详情

{item.name} 被测助手:{assistantName} · 当前为前端 Mock 结果

当前状态

{statusDescription(item)}

} title="预期结果" value={item.expected} /> {(item.status === "waiting" || item.status === "running") && ( )} {(item.status === "pass" || item.status === "fail") && ( } title="实际回复" value={item.actual} /> )} {item.status === "fail" && item.failReason && ( } title="失败原因(LLM 判断)" value={item.failReason} tone="destructive" /> )} {item.status === "skipped" && (
该用例未执行,因此没有实际回复与判断结果。
)}
)}
); } function statusDescription(item: BatchRunCase): string { const descriptions = { waiting: "已加入执行队列,正在等待可用并发。", running: "正在请求助手响应,结果尚未生成。", pass: "执行与结果判断均已完成。", fail: "执行完成,但实际回复未达到预期。", skipped: "本轮运行已结束,该用例未执行。", } as const; return descriptions[item.status]; } function DetailSection({ icon, title, value, tone = "default", }: { icon: React.ReactNode; title: string; value: string; tone?: "default" | "destructive"; }) { return (
{icon}

{title}

{value}

); } function ExecutionTimeline({ status }: { status: "waiting" | "running" }) { const isRunning = status === "running"; const steps = [ { label: "载入测试上下文", detail: isRunning ? "已完成" : "等待开始", state: isRunning ? "done" : "pending", }, { label: "请求助手响应", detail: isRunning ? "生成中(Mock)" : "尚未开始", state: isRunning ? "active" : "pending", }, { label: "执行结果判断", detail: "尚未开始", state: "pending", }, ] as const; return (

执行进度

    {steps.map((step) => (
  1. {step.state === "done" ? ( ) : step.state === "active" ? ( ) : ( )} {step.label} {step.detail}
  2. ))}
); }