n8n/packages/@n8n/instance-ai/evaluations/computer-use/render-existing.ts
Bernhard Wittmann b445221c6a
feat: Computer-use evaluation harness (no-changelog) (#29797)
Co-authored-by: Elias Meire <elias@meire.dev>
2026-05-12 08:36:12 +00:00

21 lines
806 B
TypeScript

// One-off renderer: reads computer-use-eval-results.json and writes a
// matching .html beside it. Convenient when you already have a report and
// don't want to re-run the eval just to refresh the HTML.
import { jsonParse } from 'n8n-workflow';
import { readFileSync, writeFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { renderHtml } from './report-html';
import type { RunReport } from './types';
const inputPath = resolve(process.argv[2] ?? '.eval-output/computer-use-eval-results.json');
const outputPath = inputPath.replace(/\.json$/, '.html');
const report = jsonParse<RunReport>(readFileSync(inputPath, 'utf-8'), {
errorMessage: `Invalid JSON in ${inputPath}`,
});
writeFileSync(outputPath, renderHtml(report), 'utf-8');
console.log(`HTML written to ${outputPath}`);