Skip to content

Commit 59ceaca

Browse files
authored
Merge pull request #36 from vercel-labs/allen/recursive-directory-playground-support
fix: support recursive playground directory discovery
2 parents 6839841 + 621e989 commit 59ceaca

2 files changed

Lines changed: 31 additions & 3 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@vercel/agent-eval-playground": patch
3+
---
4+
5+
Fix playground UI to correctly display nested eval results by recursively discovering eval directories instead of only checking immediate subdirectories

packages/playground/lib/data.ts

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,32 @@ export function getExperimentDetail(name: string, timestamp: string) {
129129
return null;
130130
}
131131

132-
const evalDirs = readdirSync(runDir, { withFileTypes: true })
133-
.filter((e) => e.isDirectory())
134-
.map((e) => e.name);
132+
// Recursively discover all eval result directories (directories with summary.json)
133+
const evalDirs: string[] = [];
134+
function walk(dir: string, basePath: string = "") {
135+
const dirEntries = readdirSync(dir, { withFileTypes: true });
136+
137+
for (const entry of dirEntries) {
138+
if (!entry.isDirectory() || entry.name.startsWith(".") || entry.name.startsWith("run-")) {
139+
continue;
140+
}
141+
142+
const relativePath = basePath ? `${basePath}/${entry.name}` : entry.name;
143+
const entryPath = join(dir, entry.name);
144+
const summaryPath = join(entryPath, "summary.json");
145+
146+
// Check if this is an eval result directory (has summary.json)
147+
if (existsSync(summaryPath)) {
148+
evalDirs.push(relativePath);
149+
} else {
150+
// Not an eval result, recurse into it
151+
walk(entryPath, relativePath);
152+
}
153+
}
154+
}
155+
156+
walk(runDir);
157+
evalDirs.sort();
135158

136159
const evals = evalDirs.map((evalName) => {
137160
const evalDir = join(runDir, evalName);

0 commit comments

Comments
 (0)