import { Clock, Coins, FileJson, Gauge, Hash, Star, X, Zap } from "lucide-react"; import { useEffect, useState } from "react"; import { getRequestDetails } from "../api"; import type { RequestDetails } from "../types"; interface RequestDetailProps { id: number; onClose: () => void; } export function RequestDetail({ id, onClose }: RequestDetailProps) { const [details, setDetails] = useState(null); const [loading, setLoading] = useState(true); useEffect(() => { getRequestDetails(id) .then(setDetails) .catch(console.error) .finally(() => setLoading(false)); }, [id]); if (!details && loading) { return (
Loading...
); } if (!details) return null; return (
e.stopPropagation()} > {/* Header */}

Request Details

{/* Model Info */}
{details.model}
{details.provider}
{details.errorMessage ? ( Error ) : ( Success )}
{/* Stats Grid */}
Cost
${details.usage.cost.total.toFixed(4)}
Premium Reqs
{(details.usage.premiumRequests ?? 0).toLocaleString()}
Tokens
{details.usage.totalTokens.toLocaleString()}
{details.usage.input.toLocaleString()} in ยท {details.usage.output.toLocaleString()} out
Duration
{details.duration ? `${(details.duration / 1000).toFixed(2)}s` : "-"}
TTFT
{details.ttft ? `${(details.ttft / 1000).toFixed(2)}s` : "-"}
{/* Tokens/Sec */} {details.duration && details.usage.output > 0 && (
Throughput
{((details.usage.output * 1000) / details.duration).toFixed(1)}
tokens/second
)} {/* Output */}

Output

							{JSON.stringify(details.output, null, 2)}
						
{/* Raw Metadata */}

Raw Metadata

							{JSON.stringify(details, null, 2)}
						
); }