Refactor: Use shared prompt from README config

This commit is contained in:
2025-10-13 10:57:37 -07:00
parent 94bb91dc4e
commit a2375eb537

View File

@@ -32,6 +32,7 @@ const main = async () => {
const readme = await fs.readFile(README_PATH, 'utf-8');
const models = readme.match(/<!-- MODELS_START -->\n([\s\S]+?)\n<!-- MODELS_END -->/)[1].trim().split('\n');
const percentage = parseInt(readme.match(/RUN_PERCENTAGE:\s*(\d+)/)?.[1] ?? '100', 10);
const sharedPrompt = readme.match(/SHARED_PROMPT:\s*"([\s\S]+?)"/)?.[1] ?? '';
const allTestDirs = (await fs.readdir(TESTS_DIR, { withFileTypes: true }))
.filter(d => d.isDirectory()).map(d => d.name).sort();
@@ -45,10 +46,9 @@ const main = async () => {
for (const model of models) {
genData[model] = {};
for (const dir of testsToRun) {
const testModule = await import(pathToFileURL(path.join(TESTS_DIR, dir, 'test.js')));
const { prompt, functionName } = testModule.default;
const { prompt, functionName } = (await import(pathToFileURL(path.join(TESTS_DIR, dir, 'test.js')))).default;
console.log(`Generating ${dir} for ${model}...`);
const result = await getLlmCode(prompt, model, functionName);
const result = await getLlmCode(`${sharedPrompt}\n\n${prompt.trim()}`, model, functionName);
genData[model][dir] = result?.duration ?? null;
if (!result) continue;