Skip to content

Commit 4ddbb04

Browse files
committed
feat: Add Benchmarks page for model performance comparison
- Create BenchmarksPage component with winner highlight, summary stats, and comparison charts - Add /api/v1/runs/benchmark/results endpoint for fetching benchmark data - Add useBenchmarkResults hook for React Query integration - Add Benchmarks navigation link with trophy icon - Support TPS and TTFT metrics comparison across models - Display detailed results table sorted by performance - Show model averages grouped by model name
1 parent 0dd8923 commit 4ddbb04

File tree

8 files changed

+379
-2
lines changed

8 files changed

+379
-2
lines changed

dashboard/backend/app/api/v1/runs.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,3 +239,32 @@ async def get_run_metrics(
239239
success=True,
240240
data=metrics,
241241
)
242+
243+
244+
@router.get("/benchmark/results", response_model=APIResponse)
245+
async def get_benchmark_results(
246+
db: Session = Depends(get_db_session),
247+
):
248+
"""
249+
Get benchmark results grouped by model.
250+
251+
Returns benchmark runs with their metrics, organized for comparison.
252+
"""
253+
service = RunService(db)
254+
255+
# Get all benchmark runs
256+
runs, _ = service.get_runs(run_type="benchmark", per_page=100)
257+
258+
# Get metrics for each run
259+
results = []
260+
for run in runs:
261+
metrics = service.get_run_metrics(run.id)
262+
results.append({
263+
"run": run.model_dump(),
264+
"metrics": [m.model_dump() for m in metrics],
265+
})
266+
267+
return APIResponse(
268+
success=True,
269+
data=results,
270+
)

dashboard/backend/coverage.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

dashboard/frontend/src/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import ComparePage from '@pages/compare/ComparePage';
1616
import ImportPage from '@pages/import/ImportPage';
1717
import SettingsPage from '@pages/settings/SettingsPage';
1818
import LoginPage from '@pages/auth/LoginPage';
19+
import BenchmarksPage from '@pages/benchmarks/BenchmarksPage';
1920

2021
function App() {
2122
const [mobileOpened, { toggle: toggleMobile }] = useDisclosure(false);
@@ -36,6 +37,7 @@ function App() {
3637
<Route path="/runs" element={<RunsPage />} />
3738
<Route path="/runs/:id" element={<RunDetailPage />} />
3839
<Route path="/compare" element={<ComparePage />} />
40+
<Route path="/benchmarks" element={<BenchmarksPage />} />
3941
<Route path="/import" element={<ImportPage />} />
4042
<Route path="/settings" element={<SettingsPage />} />
4143

dashboard/frontend/src/api/runs.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,14 @@ export const runsApi = {
115115
}>>(`${BASE_PATH}/stats`);
116116
return data;
117117
},
118+
119+
/**
120+
* Get benchmark results
121+
*/
122+
async getBenchmarkResults(): Promise<APIResponse<unknown[]>> {
123+
const { data } = await apiClient.get<APIResponse<unknown[]>>(`${BASE_PATH}/benchmark/results`);
124+
return data;
125+
},
118126
};
119127

120128
export default runsApi;

dashboard/frontend/src/components/common/AppShell.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import {
2929
IconSun,
3030
IconMoon,
3131
IconBrandLemonade,
32+
IconTrophy,
3233
} from '@tabler/icons-react';
3334
import { Link, useLocation, useNavigate } from 'react-router-dom';
3435
import { useUIStore } from '@/stores/uiStore';
@@ -44,6 +45,7 @@ const navLinks = [
4445
{ path: '/dashboard', label: 'Dashboard', icon: IconDashboard },
4546
{ path: '/models', label: 'Models', icon: IconCpu },
4647
{ path: '/runs', label: 'Runs', icon: IconListDetails },
48+
{ path: '/benchmarks', label: 'Benchmarks', icon: IconTrophy },
4749
{ path: '/compare', label: 'Compare', icon: IconChartBar },
4850
{ path: '/import', label: 'Import', icon: IconUpload },
4951
{ path: '/settings', label: 'Settings', icon: IconSettings },

dashboard/frontend/src/hooks/useRuns.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,4 +182,16 @@ export function useRunStats() {
182182
};
183183
}
184184

185+
export function useBenchmarkResults() {
186+
const query = useQuery({
187+
queryKey: [...QUERY_KEYS.runs.all, 'benchmark', 'results'],
188+
queryFn: () => runsApi.getBenchmarkResults(),
189+
});
190+
191+
return {
192+
...query,
193+
data: query.data?.data || [],
194+
};
195+
}
196+
185197
export { QUERY_KEYS };

0 commit comments

Comments
 (0)