Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- server/static/app.js +19 -7
server/static/app.js
CHANGED
|
@@ -84,7 +84,14 @@ const app = {
|
|
| 84 |
return;
|
| 85 |
}
|
| 86 |
|
| 87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
},
|
| 89 |
|
| 90 |
connectWS: function() {
|
|
@@ -130,9 +137,14 @@ const app = {
|
|
| 130 |
},
|
| 131 |
|
| 132 |
// ===== OPERATIONAL FLOW =====
|
| 133 |
-
startEpisode: function(taskId) {
|
|
|
|
|
|
|
|
|
|
| 134 |
this.currentTask = taskId;
|
| 135 |
-
|
|
|
|
|
|
|
| 136 |
this.episodeDone = false;
|
| 137 |
this.currentEpisodeId = null;
|
| 138 |
|
|
@@ -278,7 +290,7 @@ const app = {
|
|
| 278 |
|
| 279 |
if (!this.currentEpisodeId || this.episodeDone) {
|
| 280 |
this.autoRunAfterReset = true;
|
| 281 |
-
this.startEpisode(this.currentTask);
|
| 282 |
return;
|
| 283 |
}
|
| 284 |
|
|
@@ -297,7 +309,7 @@ const app = {
|
|
| 297 |
if (!this.currentEpisodeId || this.episodeDone) {
|
| 298 |
if (isLooping && this.currentTask) {
|
| 299 |
this.autoRunAfterReset = true;
|
| 300 |
-
this.startEpisode(this.currentTask);
|
| 301 |
} else {
|
| 302 |
this.terminalPrint('NOTICE: Episode finished. Start a tier to create a new case.');
|
| 303 |
}
|
|
@@ -434,7 +446,7 @@ const app = {
|
|
| 434 |
this.closeReward();
|
| 435 |
if (this.currentTask) {
|
| 436 |
this.autoRunAfterReset = true;
|
| 437 |
-
this.startEpisode(this.currentTask);
|
| 438 |
} else {
|
| 439 |
this.stopAutoLoop('NOTICE: Training loop paused because no tier is selected.');
|
| 440 |
}
|
|
@@ -449,7 +461,7 @@ const app = {
|
|
| 449 |
const shouldAutoStart = !!this.currentTask && (autoStartNext === true || (!this.isAutoTraining && this.episodeDone));
|
| 450 |
if (shouldAutoStart) {
|
| 451 |
this.terminalPrint('LOG: Dismiss received. Starting next episode...');
|
| 452 |
-
this.startEpisode(this.currentTask);
|
| 453 |
return;
|
| 454 |
}
|
| 455 |
|
|
|
|
| 84 |
return;
|
| 85 |
}
|
| 86 |
|
| 87 |
+
const overlay = document.getElementById('reward-overlay');
|
| 88 |
+
if (overlay) overlay.style.display = 'none';
|
| 89 |
+
|
| 90 |
+
this.terminalPrint('LOG: Quick-cycle trigger received (/). Starting next episode...');
|
| 91 |
+
if (this.isAutoTraining) {
|
| 92 |
+
this.autoRunAfterReset = true;
|
| 93 |
+
}
|
| 94 |
+
this.startEpisode(this.currentTask, { preserveAutoRun: this.isAutoTraining });
|
| 95 |
},
|
| 96 |
|
| 97 |
connectWS: function() {
|
|
|
|
| 137 |
},
|
| 138 |
|
| 139 |
// ===== OPERATIONAL FLOW =====
|
| 140 |
+
startEpisode: function(taskId, options) {
|
| 141 |
+
const opts = options || {};
|
| 142 |
+
const preserveAutoRun = opts.preserveAutoRun === true;
|
| 143 |
+
|
| 144 |
this.currentTask = taskId;
|
| 145 |
+
if (!preserveAutoRun) {
|
| 146 |
+
this.autoRunAfterReset = false;
|
| 147 |
+
}
|
| 148 |
this.episodeDone = false;
|
| 149 |
this.currentEpisodeId = null;
|
| 150 |
|
|
|
|
| 290 |
|
| 291 |
if (!this.currentEpisodeId || this.episodeDone) {
|
| 292 |
this.autoRunAfterReset = true;
|
| 293 |
+
this.startEpisode(this.currentTask, { preserveAutoRun: true });
|
| 294 |
return;
|
| 295 |
}
|
| 296 |
|
|
|
|
| 309 |
if (!this.currentEpisodeId || this.episodeDone) {
|
| 310 |
if (isLooping && this.currentTask) {
|
| 311 |
this.autoRunAfterReset = true;
|
| 312 |
+
this.startEpisode(this.currentTask, { preserveAutoRun: true });
|
| 313 |
} else {
|
| 314 |
this.terminalPrint('NOTICE: Episode finished. Start a tier to create a new case.');
|
| 315 |
}
|
|
|
|
| 446 |
this.closeReward();
|
| 447 |
if (this.currentTask) {
|
| 448 |
this.autoRunAfterReset = true;
|
| 449 |
+
this.startEpisode(this.currentTask, { preserveAutoRun: true });
|
| 450 |
} else {
|
| 451 |
this.stopAutoLoop('NOTICE: Training loop paused because no tier is selected.');
|
| 452 |
}
|
|
|
|
| 461 |
const shouldAutoStart = !!this.currentTask && (autoStartNext === true || (!this.isAutoTraining && this.episodeDone));
|
| 462 |
if (shouldAutoStart) {
|
| 463 |
this.terminalPrint('LOG: Dismiss received. Starting next episode...');
|
| 464 |
+
this.startEpisode(this.currentTask, { preserveAutoRun: this.isAutoTraining || this.autoRunAfterReset });
|
| 465 |
return;
|
| 466 |
}
|
| 467 |
|