KarlQuant commited on
Commit
13ab45f
·
verified ·
1 Parent(s): 4d744eb

Upload hub_dashboard.html

Browse files
Files changed (1) hide show
  1. hub_dashboard.html +19 -4
hub_dashboard.html CHANGED
@@ -3913,16 +3913,31 @@ setInterval(function(){
3913
  async function pollTrainingLogs() {
3914
  try {
3915
  const res = await fetch('/api/ranker/logs/recent?limit=80');
3916
- if (!res.ok) throw new Error(res.status);
3917
- const json = await res.json();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3918
  const entries = json.logs || [];
3919
  updateTerminal(entries);
3920
  updateTrainingKPIs(entries);
3921
  } catch(err) {
3922
- // Silently tolerate connection errors — dashboard may run offline
3923
  const term = document.getElementById('training-log-terminal');
3924
  if (term && !_termLines.length) {
3925
- term.innerHTML = '<div class="tlog-error">Error loading logs — ' + escHtml(err.message) + '</div>';
3926
  }
3927
  }
3928
  }
 
3913
  async function pollTrainingLogs() {
3914
  try {
3915
  const res = await fetch('/api/ranker/logs/recent?limit=80');
3916
+ // v2.3: always parse JSON even on non-2xx; service now always returns JSON
3917
+ let json;
3918
+ try {
3919
+ json = await res.json();
3920
+ } catch (parseErr) {
3921
+ // Response was not JSON (e.g. HTML error page from a proxy)
3922
+ throw new Error('HTTP ' + res.status + ' — non-JSON response from /api/ranker/logs/recent');
3923
+ }
3924
+ if (!res.ok) {
3925
+ // Service returned an error object — show it but don't abort
3926
+ const errMsg = json.error || ('HTTP ' + res.status);
3927
+ const term = document.getElementById('training-log-terminal');
3928
+ if (term && !_termLines.length) {
3929
+ term.innerHTML = '<div class="tlog-error" style="font-size:11px">⚠ ' + escHtml(errMsg) + '</div>';
3930
+ }
3931
+ return;
3932
+ }
3933
  const entries = json.logs || [];
3934
  updateTerminal(entries);
3935
  updateTrainingKPIs(entries);
3936
  } catch(err) {
3937
+ // Silently tolerate transient connection errors — show detail on first failure
3938
  const term = document.getElementById('training-log-terminal');
3939
  if (term && !_termLines.length) {
3940
+ term.innerHTML = '<div class="tlog-error" style="font-size:11px"> ' + escHtml(err.message) + '</div>';
3941
  }
3942
  }
3943
  }