mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-01-14 08:37:56 +00:00
Refactor: Use shared prompt from README config
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user