mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-17 12:42:21 +03:00
fix(homolog): isola outputs crus em homolog-report/raw para nao quebrar o ctrf merge
This commit is contained in:
@@ -38,13 +38,13 @@ const config = {
|
||||
// de emitir o "OK" literal — icontains seria falso-positivo de quebra.
|
||||
tests: [{ assert: [{ type: "javascript", value: "typeof output === 'string'" }] }],
|
||||
};
|
||||
fs.mkdirSync("homolog-report", { recursive: true });
|
||||
fs.mkdirSync("homolog-report/raw", { recursive: true });
|
||||
fs.writeFileSync(
|
||||
path.join("homolog-report", "promptfooconfig.yaml"),
|
||||
JSON.stringify(config, null, 2) // promptfoo aceita JSON como config YAML-compatível
|
||||
);
|
||||
fs.writeFileSync(
|
||||
path.join("homolog-report", "provider-misses.json"),
|
||||
path.join("homolog-report", "raw", "provider-misses.json"),
|
||||
JSON.stringify(missing, null, 2)
|
||||
);
|
||||
console.log(
|
||||
|
||||
@@ -19,7 +19,9 @@ if (!BASE || !process.env.HOMOLOG_ADMIN_PASSWORD) {
|
||||
process.exit(2);
|
||||
}
|
||||
fs.rmSync("homolog-report", { recursive: true, force: true });
|
||||
fs.mkdirSync("homolog-report", { recursive: true });
|
||||
// raw/ fica FORA do merge CTRF: `ctrf merge` tenta mesclar qualquer *.json com
|
||||
// chave "results" e quebra no output cru do promptfoo.
|
||||
fs.mkdirSync("homolog-report/raw", { recursive: true });
|
||||
const layers = []; // {name, ok, detail}
|
||||
const record = (name, ok, detail = "") => {
|
||||
layers.push({ name, ok, detail });
|
||||
@@ -89,12 +91,12 @@ try {
|
||||
"-c",
|
||||
"homolog-report/promptfooconfig.yaml",
|
||||
"-o",
|
||||
"homolog-report/promptfoo.json",
|
||||
"homolog-report/raw/promptfoo.json",
|
||||
"--no-cache",
|
||||
],
|
||||
{ encoding: "utf8", env: process.env }
|
||||
);
|
||||
const pfOut = JSON.parse(fs.readFileSync("homolog-report/promptfoo.json", "utf8"));
|
||||
const pfOut = JSON.parse(fs.readFileSync("homolog-report/raw/promptfoo.json", "utf8"));
|
||||
const pfCtrf = promptfooToCtrf(pfOut);
|
||||
fs.writeFileSync("homolog-report/providers-ctrf.json", JSON.stringify(pfCtrf, null, 2));
|
||||
record(
|
||||
|
||||
Reference in New Issue
Block a user