"use client" import { useState, useMemo, useEffect } from "react" import { Button } from "@/components/ui/button" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select" import { Filter, ArrowUpDown, Plus } from "lucide-react" import { BenchmarkEvaluationCard, type BenchmarkEvaluationCardData } from "@/components/benchmark-evaluation-card" import { Navigation } from "@/components/navigation" import { PageHeader } from "@/components/page-header" import { processEvaluationsToCards } from "@/lib/eval-processing" import type { CategoryType } from "@/lib/benchmark-schema" import { EVALUATION_CATEGORIES } from "@/lib/benchmark-schema" export default function BenchmarksPage() { const [evaluations, setEvaluations] = useState([]) const [loading, setLoading] = useState(true) const [sortBy, setSortBy] = useState<"date" | "name" | "benchmarks">("date") const [filterCategory, setFilterCategory] = useState<"all" | CategoryType>("all") // Load evaluations on mount useEffect(() => { const loadData = async () => { try { // Load all benchmark evaluation files const benchmarkFiles = [ "/benchmarks/meta-llama-3-70b.json", "/benchmarks/mistral-mistral-large.json", "/benchmarks/anthropic-claude-3-5-sonnet.json", "/benchmarks/openai-gpt-4o.json", "/benchmarks/google-gemma-2-27b.json", "/benchmarks/alibaba-qwen-2-72b.json", ] const cards = await processEvaluationsToCards(benchmarkFiles) setEvaluations(cards) } catch (error) { console.error("Failed to load evaluations:", error) } finally { setLoading(false) } } loadData() }, []) // Filter evaluations const filteredEvaluations = useMemo(() => { let filtered = [...evaluations] // Filter by specific category if (filterCategory !== "all") { filtered = filtered.filter((eval_) => eval_.categories.includes(filterCategory) ) } return filtered }, [evaluations, filterCategory]) // Sort evaluations const sortedEvaluations = useMemo(() => { const sorted = [...filteredEvaluations] switch (sortBy) { case "date": sorted.sort((a, b) => new Date(b.latest_timestamp).getTime() - new Date(a.latest_timestamp).getTime() ) break case "name": sorted.sort((a, b) => a.model_name.localeCompare(b.model_name)) break case "benchmarks": sorted.sort((a, b) => b.benchmarks_count - a.benchmarks_count) break } return sorted }, [filteredEvaluations, sortBy]) const handleDelete = (id: string) => { setEvaluations((prev) => prev.filter((e) => e.id !== id)) } if (loading) { return (
Loading evaluations...
) } return (
{/* Filters and Controls */}
{/* Stats */}
{sortedEvaluations.length}
Models Evaluated
{sortedEvaluations.reduce((sum, e) => sum + e.benchmarks_count, 0)}
Total Benchmarks
{sortedEvaluations.reduce((sum, e) => sum + e.evaluations_count, 0)}
Total Evaluations
{new Set(sortedEvaluations.flatMap(e => e.categories)).size}
Categories Covered
{/* Evaluation Cards */} {sortedEvaluations.length === 0 ? (

No evaluations found matching your filters

) : (
{sortedEvaluations.map((evaluation) => ( ))}
)}
) }