Download web/scripts/evaluate-repairs.mjs from loveaa/OneAlign: direct link, hf CLI and curl.
- Browser
- Download file 1.42 kB
-
https://huggingface.co/spaces/loveaa/OneAlign/resolve/main/web/scripts/evaluate-repairs.mjs
- Command line
-
hf download hf://spaces/loveaa/OneAlign/web/scripts/evaluate-repairs.mjs
-
curl -L -o evaluate-repairs.mjs https://huggingface.co/spaces/loveaa/OneAlign/resolve/main/web/scripts/evaluate-repairs.mjs
1.42 kB
| import fs from 'node:fs' | |
| import path from 'node:path' | |
| import {compilePlanReliable,RELIABLE_PROMPT} from '../server/planner.mjs' | |
| const root=process.cwd(),out=path.resolve('../output/kimi-jev-evaluation-20261013') | |
| const cases=JSON.parse(fs.readFileSync(path.join(out,'cases.json'),'utf8')) | |
| const ids=process.argv.slice(2).length?process.argv.slice(2):['G01','G06','G09','G28','F01','F02','F03','F04','F05','F06'] | |
| const planDir=process.env.HP_PLAN_DIR||'plans-v1.1' | |
| fs.mkdirSync(path.join(out,planDir),{recursive:true}) | |
| fs.writeFileSync(path.join(out,planDir,'prompt.txt'),RELIABLE_PROMPT) | |
| for(const id of ids){ | |
| const c=cases.find(x=>x.id===id),file=path.join(out,planDir,id+'.json') | |
| if(fs.existsSync(file)&&JSON.parse(fs.readFileSync(file,'utf8')).plan){console.log(id+' cached');continue} | |
| try{const r=await compilePlanReliable({request:c.request,context:{selected_camera:'当前选定摄像头画面',external_signals:['away','rain','doorbell'],external_signal_mode:'replay_injection_only'},root});fs.writeFileSync(file,JSON.stringify({...r,caseId:id,request:c.request},null,2));console.log(id+' '+r.plan.status+' '+r.latencyMs+'ms '+r.attempts.length+' attempts')} | |
| catch(e){fs.writeFileSync(file,JSON.stringify({caseId:id,error:e.message,attempts:e.attempts},null,2));console.log(id+' ERROR '+e.message.slice(0,150))} | |
| await new Promise(resolve=>setTimeout(resolve,1200)) | |
| } | |
| console.log('REPAIR CHECK COMPLETE') | |