Skip to content

Commit e594703

Browse files
committed
feat: update data location and support external CDN for benchmarks
1 parent 5239d93 commit e594703

5 files changed

Lines changed: 37 additions & 18 deletions

File tree

.claude/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"permissions": {
33
"allow": [
4-
"Read(data/benchmarks/**)",
4+
"Read(benchmarks/**)",
55
"mcp__context7__resolve-library-id",
66
"mcp__context7__get-library-docs",
77
"Bash(find:*)",

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ dist-ssr
2323
*.sln
2424
*.sw?
2525
.playwright-mcp
26+
benchmarks

CLAUDE.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ BalatroBench is a static web application that displays performance leaderboards
1414
- **community.html**: Community strategy leaderboard page with similar layout and functionality
1515
- **about.html**: About page with project information and metrics documentation
1616
- **script.js**: Shared JavaScript for all pages - fetches and renders leaderboard data, with theme-aware Chart.js integration, interactive expandable rows, and detailed statistics visualization
17-
- **data/**: Contains benchmark results organized by version, strategy, and data type
18-
- `data/benchmarks/v0.8.1/default/leaderboard.json`: Primary model leaderboard data
19-
- `data/community/v0.8.1/default/leaderboard.json`: Community strategy leaderboard data
17+
- **benchmarks/**: Contains benchmark results organized by version, strategy, and data type
18+
- `benchmarks/models/v0.14.1/default/leaderboard.json`: Primary model leaderboard data
19+
- `benchmarks/strategies/v0.13.2/openai/gpt-oss-20b/leaderboard.json`: Community strategy leaderboard data
2020
- Individual model result files in vendor subdirectories (e.g., `openai/gpt-5.json`, `google/gemini-2.5-pro.json`, `anthropic/claude-sonnet-4.json`)
2121

2222
### Data Structure
@@ -89,14 +89,14 @@ The application supports automatic dark mode detection with:
8989

9090
### Data Organization
9191

92-
**Benchmark Data** (`data/benchmarks/v0.8.1/default/`):
92+
**Benchmark Data** (`benchmarks/models/v0.14.1/default/`):
9393
- `leaderboard.json`: Aggregated model performance data
9494
- `[vendor]/[model].json`: Detailed individual model results with per-game statistics
95-
- Supported vendors: `openai`, `google`, `anthropic`
95+
- Supported vendors: `openai`, `google`, `anthropic`, `x-ai`, `deepseek`
9696

97-
**Community Data** (`data/community/v0.8.1/default/`):
97+
**Community Data** (`benchmarks/strategies/v0.13.2/openai/gpt-oss-20b/`):
9898
- `leaderboard.json`: Community strategy performance data
99-
- `[vendor]/[model].json`: Detailed strategy results
99+
- `[strategy]/stats.json`: Detailed strategy results
100100

101101
### Result Format
102102

data/benchmarks

Lines changed: 0 additions & 1 deletion
This file was deleted.

script.js

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ let performanceChart = null;
4141
let DEFAULT_BENCHMARK_VERSION = null; // Must be set from manifest
4242
let PAGE_TYPE = null; // 'main' or 'community'
4343

44+
// Data source configuration
45+
const IS_DEV = new URLSearchParams(window.location.search).has('dev');
46+
const DATA_BASE_URL = IS_DEV ? '' : 'http://balatrobench.b-cdn.net';
47+
4448
// Detect which page we're on
4549
function detectPageType() {
4650
const pageTitle = document.title;
@@ -54,15 +58,15 @@ function detectPageType() {
5458
function getDataPaths(version) {
5559
if (PAGE_TYPE === 'community') {
5660
return {
57-
manifestPath: 'data/benchmarks/strategies/manifest.json',
58-
leaderboardPath: `data/benchmarks/strategies/${version}/openai/gpt-oss-20b/leaderboard.json`,
59-
detailBasePath: `data/benchmarks/strategies/${version}/openai/gpt-oss-20b`
61+
manifestPath: `${DATA_BASE_URL}/benchmarks/strategies/manifest.json`,
62+
leaderboardPath: `${DATA_BASE_URL}/benchmarks/strategies/${version}/openai/gpt-oss-20b/leaderboard.json`,
63+
detailBasePath: `${DATA_BASE_URL}/benchmarks/strategies/${version}/openai/gpt-oss-20b`
6064
};
6165
} else {
6266
return {
63-
manifestPath: 'data/benchmarks/models/manifest.json',
64-
leaderboardPath: `data/benchmarks/models/${version}/default/leaderboard.json`,
65-
detailBasePath: `data/benchmarks/models/${version}/default`
67+
manifestPath: `${DATA_BASE_URL}/benchmarks/models/manifest.json`,
68+
leaderboardPath: `${DATA_BASE_URL}/benchmarks/models/${version}/default/leaderboard.json`,
69+
detailBasePath: `${DATA_BASE_URL}/benchmarks/models/${version}/default`
6670
};
6771
}
6872
}
@@ -1035,12 +1039,27 @@ async function loadAndRenderRequest(state) {
10351039
]);
10361040

10371041
const imgEl = overlay.querySelector('#run-screenshot');
1038-
imgEl.src = `${runBase}/screenshot.avif`;
1042+
// Try formats in order: webp -> png -> avif
1043+
const formats = ['webp', 'png', 'avif'];
1044+
let formatIndex = 0;
1045+
1046+
const tryNextFormat = () => {
1047+
if (formatIndex < formats.length) {
1048+
imgEl.src = `${runBase}/screenshot.${formats[formatIndex]}`;
1049+
formatIndex++;
1050+
}
1051+
};
1052+
10391053
imgEl.onerror = () => {
1040-
imgEl.onerror = null;
1041-
imgEl.src = `${runBase}/screenshot.png`;
1054+
if (formatIndex < formats.length) {
1055+
tryNextFormat();
1056+
} else {
1057+
imgEl.onerror = null;
1058+
}
10421059
};
10431060

1061+
tryNextFormat();
1062+
10441063
overlay.querySelector('#run-reasoning').textContent = reasoning || '(No reasoning.md)';
10451064

10461065
const toolNameDiv = overlay.querySelector('#run-tool-name');

0 commit comments

Comments
 (0)