FABLESLIP commited on
Commit
5b09386
·
verified ·
1 Parent(s): 6afc845

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -20
app.py CHANGED
@@ -505,24 +505,16 @@ async def warmup_start(payload: Optional[Dict[str, Any]] = Body(None)):
505
  @app.get("/warmup/status", tags=["warmup"])
506
  def warmup_status():
507
  """ Retourne l'état courant du warm-up (progression, logs, etc.). """
508
- with warmup_lock:
509
-
510
-
511
-
512
-
513
- data = deepcopy(warmup_state)
514
-
515
-
516
-
517
- # Identifiant d'instance pour aider à diagnostiquer les bascules de réplique
518
- data["instance_id"] = INSTANCE_ID
519
-
520
 
521
- # --- AJOUT : état du cache actuel ---
522
- cached = _list_cached_repos()
523
- data["audit_count"] = len(cached)
524
- data["audit_cached"] = cached
525
- # --- FIN AJOUT ---
526
 
527
 
528
 
@@ -958,6 +950,8 @@ async function refreshWarmupUI(){
958
  try{
959
  const r = await fetch('/warmup/status');
960
 
 
 
961
 
962
 
963
  // Instance courante (ajout backend)
@@ -1002,12 +996,12 @@ async function refreshWarmupUI(){
1002
  // Préambule construit dynamiquement à partir de /warmup/status
1003
  let prefaceNow = '';
1004
  if (Array.isArray(s.audit_cached)) {
1005
- prefaceNow = `[Instance ${instanceId}]` + '\n' + prefaceNow;
1006
-
1007
- const n = Number.isFinite(s.audit_count) ? s.audit_count : s.audit_cached.length;
1008
  prefaceNow =
 
1009
  'Déjà en cache (' + n + '):\n' +
1010
  s.audit_cached.map(m => ' • ' + m).join('\n');
 
1011
  }
1012
  if (Array.isArray(window.lastRequestedModels) && window.lastRequestedModels.length) {
1013
  prefaceNow += (prefaceNow ? '\n\n' : '') +
 
505
  @app.get("/warmup/status", tags=["warmup"])
506
  def warmup_status():
507
  """ Retourne l'état courant du warm-up (progression, logs, etc.). """
508
+ with warmup_lock:
509
+ data = deepcopy(warmup_state)
510
+ # Identifiant d'instance pour aider à diagnostiquer les bascules de réplique
511
+ data["instance_id"] = INSTANCE_ID
512
+ # --- AJOUT : état du cache actuel ---
513
+ cached = _list_cached_repos()
514
+ data["audit_count"] = len(cached)
515
+ data["audit_cached"] = cached
516
+ # --- FIN AJOUT ---
 
 
 
517
 
 
 
 
 
 
518
 
519
 
520
 
 
950
  try{
951
  const r = await fetch('/warmup/status');
952
 
953
+ if(!r.ok) return;
954
+ const s = await r.json();
955
 
956
 
957
  // Instance courante (ajout backend)
 
996
  // Préambule construit dynamiquement à partir de /warmup/status
997
  let prefaceNow = '';
998
  if (Array.isArray(s.audit_cached)) {
999
+ const n = Number.isFinite(s.audit_count) ? s.audit_count : s.audit_cached.length;
 
 
1000
  prefaceNow =
1001
+ `[Instance ${instanceId}]` + '\n' +
1002
  'Déjà en cache (' + n + '):\n' +
1003
  s.audit_cached.map(m => ' • ' + m).join('\n');
1004
+
1005
  }
1006
  if (Array.isArray(window.lastRequestedModels) && window.lastRequestedModels.length) {
1007
  prefaceNow += (prefaceNow ? '\n\n' : '') +