Update app.py
Browse files
app.py
CHANGED
|
@@ -1260,29 +1260,14 @@ async function refreshWarmupUI(){
|
|
| 1260 |
if (warmupPopupStatus) warmupPopupStatus.textContent = running ? 'Téléchargement en cours…' : 'Terminé';
|
| 1261 |
|
| 1262 |
// PRÉAMBULE FIXE (conservé pendant tout le run)
|
| 1263 |
-
|
| 1264 |
-
|
| 1265 |
-
|
| 1266 |
-
? warmupPreface
|
| 1267 |
-
: (()=>{
|
| 1268 |
-
const n = Number.isFinite(s.audit_count)
|
| 1269 |
-
? s.audit_count
|
| 1270 |
-
: (Array.isArray(s.audit_cached) ? s.audit_cached.length : 0);
|
| 1271 |
-
const cachedList = Array.isArray(s.audit_cached) ? s.audit_cached : [];
|
| 1272 |
-
const asked = Array.isArray(window.lastRequestedModels) ? window.lastRequestedModels : [];
|
| 1273 |
-
return (
|
| 1274 |
-
`[Instance ${instanceId}]` + '\n' +
|
| 1275 |
-
'Déjà en cache (' + n + '):\n' +
|
| 1276 |
-
cachedList.map(m => ' • ' + m).join('\n') + '\n\n' +
|
| 1277 |
-
'Demandé dans cette exécution (' + asked.length + '):\n' +
|
| 1278 |
-
asked.map(m => ' • ' + m).join('\n')
|
| 1279 |
-
);
|
| 1280 |
-
})();
|
| 1281 |
-
if (warmupLogs) {
|
| 1282 |
-
warmupLogs.textContent = fixedPreface + '\n\n' + logsTxt;
|
| 1283 |
warmupLogs.scrollTop = warmupLogs.scrollHeight;
|
| 1284 |
}
|
| 1285 |
|
|
|
|
| 1286 |
if (running) {
|
| 1287 |
if (!userClosedWarmupPopup) openWarmupPopup();
|
| 1288 |
if (!warmupTimer) warmupTimer = setInterval(refreshWarmupUI, 1000);
|
|
@@ -1480,6 +1465,25 @@ if (launchSelectedBtn){
|
|
| 1480 |
launchSelectedBtn.addEventListener('click', async ()=>{
|
| 1481 |
const picks = Array.from(repoListEl.querySelectorAll('input[type="checkbox"]'))
|
| 1482 |
.filter(cb=>cb.checked).map(cb=>cb.value);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1483 |
if(!picks.length){ alert('Sélectionne au moins un modèle.'); return; }
|
| 1484 |
window.lastRequestedModels = picks.slice();
|
| 1485 |
userClosedWarmupPopup = false;
|
|
|
|
| 1260 |
if (warmupPopupStatus) warmupPopupStatus.textContent = running ? 'Téléchargement en cours…' : 'Terminé';
|
| 1261 |
|
| 1262 |
// PRÉAMBULE FIXE (conservé pendant tout le run)
|
| 1263 |
+
// Afficher "préface + logs" uniquement pendant l'exécution,
|
| 1264 |
+
// le récap final sera posé plus bas quand s.done === true
|
| 1265 |
+
if (running && warmupLogs) {
|
| 1266 |
+
warmupLogs.textContent = ((warmupPreface && warmupPreface.trim()) ? warmupPreface : fixedPreface) + '\n\n' + logsTxt;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1267 |
warmupLogs.scrollTop = warmupLogs.scrollHeight;
|
| 1268 |
}
|
| 1269 |
|
| 1270 |
+
|
| 1271 |
if (running) {
|
| 1272 |
if (!userClosedWarmupPopup) openWarmupPopup();
|
| 1273 |
if (!warmupTimer) warmupTimer = setInterval(refreshWarmupUI, 1000);
|
|
|
|
| 1465 |
launchSelectedBtn.addEventListener('click', async ()=>{
|
| 1466 |
const picks = Array.from(repoListEl.querySelectorAll('input[type="checkbox"]'))
|
| 1467 |
.filter(cb=>cb.checked).map(cb=>cb.value);
|
| 1468 |
+
// Réinitialiser l’état d’affichage pour ce nouveau run
|
| 1469 |
+
warmupPreface = '';
|
| 1470 |
+
window.lastRequestedModels = picks.slice();
|
| 1471 |
+
|
| 1472 |
+
// Construire immédiatement une préface exacte (Demandés + Ignorés + Cache global)
|
| 1473 |
+
try {
|
| 1474 |
+
const ra = await fetch('/warmup/audit');
|
| 1475 |
+
const audit = ra.ok ? await ra.json() : null;
|
| 1476 |
+
const cached = (audit && Array.isArray(audit.cached)) ? audit.cached : [];
|
| 1477 |
+
const ignored = picks.filter(m => cached.includes(m));
|
| 1478 |
+
warmupPreface =
|
| 1479 |
+
'Demandés (' + picks.length + '):\n' +
|
| 1480 |
+
picks.map(m => ' • ' + m).join('\n') + '\n\n' +
|
| 1481 |
+
'⬛ Ignorés (déjà en cache) (' + ignored.length + '):\n' +
|
| 1482 |
+
(ignored.length ? ignored.map(m => ' • ' + m).join('\n') : '') + '\n\n' +
|
| 1483 |
+
'📦 Déjà en cache global (' + cached.length + '):\n' +
|
| 1484 |
+
(cached.length ? cached.map(m => ' • ' + m).join('\n') : '');
|
| 1485 |
+
} catch(_) { /* no-op */ }
|
| 1486 |
+
|
| 1487 |
if(!picks.length){ alert('Sélectionne au moins un modèle.'); return; }
|
| 1488 |
window.lastRequestedModels = picks.slice();
|
| 1489 |
userClosedWarmupPopup = false;
|