Ferrell Synthetic Intelligence commited on
Commit
c3360ca
·
1 Parent(s): 51e716f

Add TinyLiquid Training Room adapter

Browse files
Files changed (1) hide show
  1. app.js +12 -0
app.js CHANGED
@@ -332,6 +332,16 @@ async function trainingRequest(action, payload = {}) {
332
  } catch (error) { $('#training-status').textContent = `Blocked: ${error.message}`; appendLog('TRAINING', error.message, 'warning'); }
333
  }
334
 
 
 
 
 
 
 
 
 
 
 
335
  async function digestFile(file) {
336
  const buffer = await file.arrayBuffer();
337
  const digest = await crypto.subtle.digest('SHA-256', buffer);
@@ -400,6 +410,8 @@ async function boot() {
400
  $('#debug-file').onclick = debugActiveFile;
401
  $('#training-verify').onclick = () => trainingRequest('start', { id: 'verify-release', approved: true });
402
  $('#training-stop').onclick = () => trainingRequest('stop');
 
 
403
  loadCommunity();
404
  $('#input').onkeydown = event => { if (event.key === 'Enter') sendChat(); };
405
  }
 
332
  } catch (error) { $('#training-status').textContent = `Blocked: ${error.message}`; appendLog('TRAINING', error.message, 'warning'); }
333
  }
334
 
335
+ async function refreshTrainingStatus() {
336
+ try {
337
+ const response = await fetch('http://127.0.0.1:4777/api/training/status');
338
+ if (!response.ok) return;
339
+ const result = await response.json();
340
+ const active = result.active ? `running: ${result.active.id}` : 'idle';
341
+ $('#training-status').textContent = `Training Room ${active} | ${result.jobs.length} allowlisted job(s)`;
342
+ } catch { /* daemon is optional while the static shell is offline */ }
343
+ }
344
+
345
  async function digestFile(file) {
346
  const buffer = await file.arrayBuffer();
347
  const digest = await crypto.subtle.digest('SHA-256', buffer);
 
410
  $('#debug-file').onclick = debugActiveFile;
411
  $('#training-verify').onclick = () => trainingRequest('start', { id: 'verify-release', approved: true });
412
  $('#training-stop').onclick = () => trainingRequest('stop');
413
+ refreshTrainingStatus();
414
+ setInterval(refreshTrainingStatus, 5000);
415
  loadCommunity();
416
  $('#input').onkeydown = event => { if (event.key === 'Enter') sendChat(); };
417
  }