File size: 1,415 Bytes
90d354b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 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')
|