dsh-livebench-panel 0.1.20 → 0.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.js +18 -1
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -554,7 +554,7 @@ function apply(ctx) {
554
554
  /** All runs: runId -> record. Several evaluations may run concurrently. */
555
555
  const runs = new Map();
556
556
 
557
- const startRun = async (body) => {
557
+ const startRun = async (body, autoRetries = 0) => {
558
558
  const layout = livebenchLayout();
559
559
  if (!layout.available) {
560
560
  return { status: 409, payload: { ok: false, error: `LiveBench venv not found under ${layout.root}` } };
@@ -651,6 +651,7 @@ function apply(ctx) {
651
651
  args.push("--question-end", String(asInt(body.end, 0, 100000, 0)));
652
652
  }
653
653
  if (body.resume === true) args.push("--resume");
654
+ if (body.retryFailures === true) args.push("--retry-failures");
654
655
 
655
656
  const env = {
656
657
  ...process.env,
@@ -698,6 +699,8 @@ function apply(ctx) {
698
699
  id: `${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
699
700
  proc: child,
700
701
  displayName,
702
+ body,
703
+ autoRetries,
701
704
  exitCode: null,
702
705
  startedAt: new Date().toISOString(),
703
706
  command: [layout.pythonExe, ...args].join(" "),
@@ -720,6 +723,20 @@ function apply(ctx) {
720
723
  child.on("close", (code) => {
721
724
  record.exitCode = code === null ? -1 : code;
722
725
  record.log.push(`[exit ${record.exitCode}]`);
726
+ // 自动补跑:正常结束但存在 $ERROR$ 答案时,用 --resume --retry-failures
727
+ // 只重跑失败题(最多 2 轮)。网络瞬断/超时导致的失败会被自动修复。
728
+ if (record.exitCode === 0 && record.autoRetries < 2 && record.body) {
729
+ const errors = countErrorAnswers(layout.dataDir, record.displayName);
730
+ if (errors > 0) {
731
+ record.log.push(`[自动补跑] 检测到 ${errors} 条失败答案,自动重试(第 ${record.autoRetries + 1}/2 轮)`);
732
+ const retryBody = { ...record.body, resume: true, retryFailures: true };
733
+ setTimeout(() => {
734
+ startRun(retryBody, record.autoRetries + 1).catch((e) => {
735
+ appendLog(record, `[自动补跑启动失败] ${e.message}`);
736
+ });
737
+ }, 3000);
738
+ }
739
+ }
723
740
  });
724
741
 
725
742
  return { status: 200, payload: { ok: true, runId: record.id, displayName, command: record.command } };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-livebench-panel",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "description": "DSH web plugin: a LiveBench tab in the Trajectory view (right of 对话/轨迹). Run LiveBench evaluations against every model configured in the DeepSeek Harness — pick provider/model, category, task, release and question range from dropdowns, watch progress, and read scores in place.",
5
5
  "license": "MIT",
6
6
  "type": "module",