@@ -6,7 +6,6 @@ import { ScatterChart, Scatter, XAxis, YAxis, Label, Customized, Cross } from "r
66import { TaskMetrics , type Run } from "@/db"
77
88import { ChartConfig , ChartLegend , ChartLegendContent } from "@/components/ui/chart"
9- import { ModelInfo , RooCodeSettings } from "@/lib/schemas"
109import { formatTokens , formatCurrency , formatDuration , formatScore } from "@/lib"
1110import {
1211 ChartContainer ,
@@ -20,6 +19,7 @@ import {
2019 TableHeader ,
2120 TableRow ,
2221} from "@/components/ui"
22+ import { useOpenRouterModels } from "@/lib/hooks/use-open-router-models"
2323
2424export function Evals ( {
2525 runs,
@@ -29,25 +29,29 @@ export function Evals({
2929 score : number
3030 languageScores ?: Record < "go" | "java" | "javascript" | "python" | "rust" , number >
3131 taskMetrics : TaskMetrics
32- settings ?: RooCodeSettings
33- modelInfo ?: ModelInfo | null
32+ modelId ?: string
3433 } ) [ ]
3534} ) {
36- const data = useMemo (
35+ const { data : openRouterModels } = useOpenRouterModels ( )
36+
37+ const tableData = useMemo (
3738 ( ) =>
38- runs
39- . map ( ( run ) => ( {
40- label : run . description || run . model ,
41- score : run . score ,
42- cost : run . taskMetrics . cost ,
43- } ) )
44- . filter ( ( { cost } ) => cost < 100 ) ,
45- [ runs ] ,
39+ runs . map ( ( run ) => ( {
40+ ...run ,
41+ label : run . description || run . model ,
42+ score : run . score ,
43+ cost : run . taskMetrics . cost ,
44+ model : openRouterModels ?. [ run . modelId ?? "" ] ,
45+ modelInfo : openRouterModels ?. [ run . modelId ?? "" ] ?. modelInfo ,
46+ } ) ) ,
47+ [ runs , openRouterModels ] ,
4648 )
4749
50+ const chartData = useMemo ( ( ) => tableData . filter ( ( { cost } ) => cost < 100 ) , [ tableData ] )
51+
4852 const chartConfig = useMemo (
49- ( ) => data . reduce ( ( acc , run ) => ( { ...acc , [ run . label ] : run } ) , { } as ChartConfig ) ,
50- [ data ] ,
53+ ( ) => chartData . reduce ( ( acc , run ) => ( { ...acc , [ run . label ] : run } ) , { } as ChartConfig ) ,
54+ [ chartData ] ,
5155 )
5256
5357 return (
@@ -119,10 +123,10 @@ export function Evals({
119123 </ TableRow >
120124 </ TableHeader >
121125 < TableBody className = "font-mono" >
122- { runs . map ( ( run ) => (
126+ { tableData . map ( ( run ) => (
123127 < TableRow key = { run . id } >
124- < TableCell >
125- < div className = "font-sans" > { run . label } </ div >
128+ < TableCell title = { run . model ?. description } >
129+ < div className = "font-sans" > { run . model ?. name || run . label } </ div >
126130 < div className = "text-xs opacity-50" >
127131 { formatTokens ( run . modelInfo ?. contextWindow ?? 0 ) }
128132 </ div >
@@ -190,7 +194,7 @@ export function Evals({
190194 </ YAxis >
191195 < ChartTooltip content = { < ChartTooltipContent labelKey = "label" hideIndicator /> } />
192196 < Customized component = { renderQuadrant } />
193- { data . map ( ( d , i ) => (
197+ { chartData . map ( ( d , i ) => (
194198 < Scatter key = { d . label } name = { d . label } data = { [ d ] } fill = { `hsl(var(--chart-${ i + 1 } ))` } />
195199 ) ) }
196200 < ChartLegend content = { < ChartLegendContent /> } />
0 commit comments