File size: 1,593 Bytes
8fa3acc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
"use client";
import Modal from "./Modal";

// Fonction utilitaire pour nettoyer le nom du benchmark
const getCleanBenchmarkName = (name) => {
  const parts = name.split("|");
  if (parts.length >= 2) return parts[1];
  return name;
};

export default function ModelDetailsModal({ entry, onClose }) {
  const modelName = entry.display_name || entry.name?.replace(".json", "") || "Unknown Model";

  return (
    <Modal onClose={onClose}>
      <div className="space-y-4 max-w-2xl mx-auto">
        {/* En-tête avec nom du modèle */}
        <div className="text-center sticky top-0 bg-white z-10 pb-2">
          <h3 className="text-2xl font-bold text-blue-700">{modelName}</h3>
          <p className="text-sm text-gray-500">Model Details</p>
        </div>

        {/* Contenu des benchmarks */}
        <div className="space-y-4">
          {Object.entries(entry.results || {}).map(([benchmark, metrics]) => (
            <div key={benchmark} className="p-4 border rounded-md bg-white shadow-md">
              <h4 className="text-lg font-medium text-blue-600 mb-2">
                📊 {getCleanBenchmarkName(benchmark)}
              </h4>
              <ul className="ml-4 text-sm text-gray-700 list-disc">
                {Object.entries(metrics).map(([metric, value]) => (
                  <li key={metric}>
                    <strong>{metric}</strong>:{" "}
                    {typeof value === "number" ? value.toFixed(4) : value}
                  </li>
                ))}
              </ul>
            </div>
          ))}
        </div>
      </div>
    </Modal>
  );
}