mirror of
https://github.com/R0m1k3/Loki.git
synced 2026-10-22 06:28:11 +02:00
UI: affichage de la RAM systeme dans la barre laterale
Nouvel endpoint /api/ram (lecture /proc/meminfo, used/total en Mo, 0 hors Linux) et bloc RAM dans la sidebar a cote du GPU, rafraichi toutes les 3 s. Masque si pas de /proc/meminfo (Windows/mac).
This commit is contained in:
1 parent
ee76638f15
commit
dbb0ac40a4
7 files changed
+60
-2
No files matched your search
@@ -29,6 +29,9 @@
|
||||
<details open><summary>GPU</summary>
|
||||
<div id="vram" class="muted">…</div>
|
||||
</details>
|
||||
<details open id="ram-details"><summary>RAM</summary>
|
||||
<div id="ram" class="muted">…</div>
|
||||
</details>
|
||||
<details open id="cfg-details"><summary>Config active</summary>
|
||||
<div id="cfg" class="muted">…</div>
|
||||
</details>
|
||||
|
||||
@@ -64,6 +64,16 @@ async function loadVram(){
|
||||
'<div class="muted">'+(g.used/1024).toFixed(1)+' / '+(g.total/1024).toFixed(1)+' GiB · GPU '+g.util+'% · '+g.temp+'°C</div></div>';
|
||||
}).join('') || '<span class="muted">(pas de GPU)</span>';
|
||||
}
|
||||
async function loadRam(){
|
||||
const m=await jget('/api/ram');
|
||||
const box=document.getElementById('ram-details');
|
||||
if(!m || !m.total){ if(box) box.style.display='none'; return; }
|
||||
if(box) box.style.display='';
|
||||
const pct=Math.round(m.used*100/m.total);
|
||||
document.getElementById('ram').innerHTML =
|
||||
'<div style="margin:6px 0"><div class="bar"><div style="width:'+pct+'%"></div></div>'+
|
||||
'<div class="muted">'+(m.used/1024).toFixed(1)+' / '+(m.total/1024).toFixed(1)+' GiB · '+pct+'%</div></div>';
|
||||
}
|
||||
async function loadCfg(){
|
||||
const c=await jget('/api/config');
|
||||
const keys=['BIN','MODEL','CTX','BATCH','UBATCH','NGL','PORT'];
|
||||
|
||||
@@ -216,5 +216,5 @@ async function saveCrawlUrl(){
|
||||
const url=document.getElementById('crawl-url').value.trim();
|
||||
renderInternet(await jpost('/api/internet',{url}));
|
||||
}
|
||||
async function loadAll(){ await Promise.all([loadStatus(),loadVram(),loadCfg(),loadPresets(),loadAgent(),loadInternet(),loadApiKey(),loadPrefs(),loadLlamacpp()]); }
|
||||
async function loadAll(){ await Promise.all([loadStatus(),loadVram(),loadRam(),loadCfg(),loadPresets(),loadAgent(),loadInternet(),loadApiKey(),loadPrefs(),loadLlamacpp()]); }
|
||||
async function act(a){ toast(a+'…'); await jpost('/api/'+a); setTimeout(loadAll,1500); }
|
||||
@@ -144,3 +144,4 @@ async function send(){
|
||||
loadAll();
|
||||
setInterval(loadStatus, 5000);
|
||||
setInterval(loadVram, 3000);
|
||||
setInterval(loadRam, 3000);
|
||||
Reference in new issue
Block a user