tahamajs/IE / Projects /front /src /components /agents /AgentMetricsChart.tsx
tahamajs's picture
download
raw
2.73 kB
// src/components/agents/AgentMetricsChart.tsx
import { AgentPipeline } from "@/types/multi-agent";
interface AgentMetricsChartProps {
pipeline: AgentPipeline;
}
export function AgentMetricsChart({ pipeline }: AgentMetricsChartProps) {
const completed = pipeline.tasks.filter(t => t.status === "completed").length;
const failed = pipeline.tasks.filter(t => t.status === "failed").length;
const running = pipeline.tasks.filter(t => t.status === "running").length;
const pending = pipeline.tasks.filter(t => t.status === "pending").length;
const total = pipeline.tasks.length;
const progress = total > 0 ? (completed / total) * 100 : 0;
return (
<div className="bg-white dark:bg-gray-800 rounded-2xl border border-gray-200 dark:border-gray-700 p-4">
<h3 className="text-sm font-bold mb-3">Pipeline Metrics</h3>
{/* Progress bar */}
<div className="mb-4">
<div className="flex justify-between text-xs text-gray-500 mb-1">
<span>Overall Progress</span>
<span>{Math.round(progress)}%</span>
</div>
<div className="h-2 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden">
<div className="h-full bg-primary rounded-full transition-all duration-500" style={{ width: `${progress}%` }} />
</div>
</div>
{/* Task stats */}
<div className="grid grid-cols-4 gap-2 text-center text-xs">
<div>
<div className="text-lg font-bold text-green-600">{completed}</div>
<div className="text-gray-500">Completed</div>
</div>
<div>
<div className="text-lg font-bold text-blue-600">{running}</div>
<div className="text-gray-500">Running</div>
</div>
<div>
<div className="text-lg font-bold text-yellow-600">{pending}</div>
<div className="text-gray-500">Pending</div>
</div>
<div>
<div className="text-lg font-bold text-red-600">{failed}</div>
<div className="text-gray-500">Failed</div>
</div>
</div>
{/* Time metrics */}
{pipeline.results && (
<div className="mt-4 pt-3 border-t border-gray-200 dark:border-gray-700">
<div className="flex justify-between text-xs">
<span className="text-gray-500">Total Time</span>
<span className="font-medium">{(pipeline.results.metrics.totalTimeMs / 1000).toFixed(1)}s</span>
</div>
<div className="flex justify-between text-xs mt-1">
<span className="text-gray-500">Token Usage</span>
<span className="font-medium">{pipeline.results.metrics.tokenUsage.toLocaleString()}</span>
</div>
</div>
)}
</div>
);
}

Xet Storage Details

Size:
2.73 kB
·
Xet hash:
7f102bc085881b9dc971e00ec02c1eee1450d4949b511fb87100f9944f527bf9

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.