Spaces:
Running
Running
stats change
Browse files- app/models/page.tsx +17 -3
- lib/backend-artifacts.ts +1 -0
app/models/page.tsx
CHANGED
|
@@ -10,7 +10,7 @@ import { ModelCompareDialog } from "@/components/model-compare-dialog"
|
|
| 10 |
import { ModelTable } from "@/components/model-table"
|
| 11 |
import { Navigation } from "@/components/navigation"
|
| 12 |
import { ParamRangePicker } from "@/components/param-range-picker"
|
| 13 |
-
import { fetchDevelopers, fetchModelCards, fetchBenchmarkMetadata, type DeveloperListItem } from "@/lib/dashboard-data-client"
|
| 14 |
import type { BenchmarkCard } from "@/lib/benchmark-schema"
|
| 15 |
import { PARAM_RANGE_MAX_INDEX, paramStepToNumeric } from "@/lib/param-range"
|
| 16 |
|
|
@@ -34,6 +34,7 @@ export default function ModelsPage() {
|
|
| 34 |
const [evaluations, setEvaluations] = useState<BenchmarkEvaluationCardData[]>([])
|
| 35 |
const [developers, setDevelopers] = useState<DeveloperListItem[]>([])
|
| 36 |
const [benchmarkCards, setBenchmarkCards] = useState<Record<string, BenchmarkCard>>({})
|
|
|
|
| 37 |
const [loadingModels, setLoadingModels] = useState(true)
|
| 38 |
const [loadingDevelopers, setLoadingDevelopers] = useState(false)
|
| 39 |
const [developersReady, setDevelopersReady] = useState(false)
|
|
@@ -61,8 +62,23 @@ export default function ModelsPage() {
|
|
| 61 |
console.error("Failed to load evaluations:", error)
|
| 62 |
})
|
| 63 |
.finally(() => setLoadingModels(false))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
}, [])
|
| 65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
useEffect(() => {
|
| 67 |
if (!groupByDeveloper || developersReady || loadingDevelopers) return
|
| 68 |
setLoadingDevelopers(true)
|
|
@@ -77,8 +93,6 @@ export default function ModelsPage() {
|
|
| 77 |
})
|
| 78 |
}, [developersReady, groupByDeveloper, loadingDevelopers])
|
| 79 |
|
| 80 |
-
const totalBenchmarks = useMemo(() => Object.keys(benchmarkCards).length, [benchmarkCards])
|
| 81 |
-
|
| 82 |
// Models — filter + sort
|
| 83 |
const sortedEvaluations = useMemo(() => {
|
| 84 |
const query = deferredSearchQuery.trim().toLowerCase()
|
|
|
|
| 10 |
import { ModelTable } from "@/components/model-table"
|
| 11 |
import { Navigation } from "@/components/navigation"
|
| 12 |
import { ParamRangePicker } from "@/components/param-range-picker"
|
| 13 |
+
import { fetchCorpusAggregates, fetchDevelopers, fetchModelCards, fetchBenchmarkMetadata, type DeveloperListItem } from "@/lib/dashboard-data-client"
|
| 14 |
import type { BenchmarkCard } from "@/lib/benchmark-schema"
|
| 15 |
import { PARAM_RANGE_MAX_INDEX, paramStepToNumeric } from "@/lib/param-range"
|
| 16 |
|
|
|
|
| 34 |
const [evaluations, setEvaluations] = useState<BenchmarkEvaluationCardData[]>([])
|
| 35 |
const [developers, setDevelopers] = useState<DeveloperListItem[]>([])
|
| 36 |
const [benchmarkCards, setBenchmarkCards] = useState<Record<string, BenchmarkCard>>({})
|
| 37 |
+
const [totalBenchmarksFromHeadline, setTotalBenchmarksFromHeadline] = useState<number | null>(null)
|
| 38 |
const [loadingModels, setLoadingModels] = useState(true)
|
| 39 |
const [loadingDevelopers, setLoadingDevelopers] = useState(false)
|
| 40 |
const [developersReady, setDevelopersReady] = useState(false)
|
|
|
|
| 62 |
console.error("Failed to load evaluations:", error)
|
| 63 |
})
|
| 64 |
.finally(() => setLoadingModels(false))
|
| 65 |
+
|
| 66 |
+
fetchCorpusAggregates()
|
| 67 |
+
.then((aggregates) => {
|
| 68 |
+
if (typeof aggregates?.total_benchmarks === "number") {
|
| 69 |
+
setTotalBenchmarksFromHeadline(aggregates.total_benchmarks)
|
| 70 |
+
}
|
| 71 |
+
})
|
| 72 |
+
.catch((error) => {
|
| 73 |
+
console.error("Failed to load corpus aggregates:", error)
|
| 74 |
+
})
|
| 75 |
}, [])
|
| 76 |
|
| 77 |
+
const totalBenchmarks = useMemo(
|
| 78 |
+
() => totalBenchmarksFromHeadline ?? Object.keys(benchmarkCards).length,
|
| 79 |
+
[totalBenchmarksFromHeadline, benchmarkCards],
|
| 80 |
+
)
|
| 81 |
+
|
| 82 |
useEffect(() => {
|
| 83 |
if (!groupByDeveloper || developersReady || loadingDevelopers) return
|
| 84 |
setLoadingDevelopers(true)
|
|
|
|
| 93 |
})
|
| 94 |
}, [developersReady, groupByDeveloper, loadingDevelopers])
|
| 95 |
|
|
|
|
|
|
|
| 96 |
// Models — filter + sort
|
| 97 |
const sortedEvaluations = useMemo(() => {
|
| 98 |
const query = deferredSearchQuery.trim().toLowerCase()
|
lib/backend-artifacts.ts
CHANGED
|
@@ -179,6 +179,7 @@ export interface CorpusAggregates {
|
|
| 179 |
provenance: Stratified<ProvenanceCorpusBlock>
|
| 180 |
comparability: Stratified<ComparabilityCorpusBlock>
|
| 181 |
reporting_org_count?: number
|
|
|
|
| 182 |
developers?: DeveloperListEntry[]
|
| 183 |
families?: Array<{
|
| 184 |
family_key: string
|
|
|
|
| 179 |
provenance: Stratified<ProvenanceCorpusBlock>
|
| 180 |
comparability: Stratified<ComparabilityCorpusBlock>
|
| 181 |
reporting_org_count?: number
|
| 182 |
+
total_benchmarks?: number
|
| 183 |
developers?: DeveloperListEntry[]
|
| 184 |
families?: Array<{
|
| 185 |
family_key: string
|