lisätty admin laitteistonäkymä
This commit is contained in:
@@ -92,6 +92,7 @@ tr:hover td { background:#1c2333; }
|
||||
<div class="tabs">
|
||||
<div class="tab active" onclick="showTab('sessions')">Sessiot</div>
|
||||
<div class="tab" onclick="showTab('pairs')">Tokenisointiparit</div>
|
||||
<div class="tab" onclick="showTab('hardware')">Laitteisto & Mallit</div>
|
||||
</div>
|
||||
|
||||
<div id="sessions" class="panel active">
|
||||
@@ -119,6 +120,19 @@ tr:hover td { background:#1c2333; }
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="hardware" class="panel">
|
||||
<div class="stats-grid" id="hardware-stats"></div>
|
||||
<h2 style="margin-top: 10px; margin-bottom: 10px; color: var(--accent); font-size: 16px;">Käytettävissä olevat paikalliset kielimallit</h2>
|
||||
<div class="table-wrap">
|
||||
<table>
|
||||
<thead><tr>
|
||||
<th>Nimi</th><th>Koko</th><th>Parametrit</th>
|
||||
</tr></thead>
|
||||
<tbody id="models-body"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function showTab(name) {
|
||||
document.querySelectorAll('.panel').forEach(p => p.classList.remove('active'));
|
||||
@@ -150,12 +164,16 @@ function duration(start, end) {
|
||||
}
|
||||
|
||||
async function load() {
|
||||
const [statsRes, sessionsRes, pairsRes] = await Promise.all([
|
||||
fetch('/api/stats'), fetch('/api/sessions'), fetch('/api/pairs')
|
||||
const [statsRes, sessionsRes, pairsRes, hwRes, modelsRes] = await Promise.all([
|
||||
fetch('/api/stats'), fetch('/api/sessions'), fetch('/api/pairs'),
|
||||
fetch('/api/v1/hardware').catch(() => ({json: async()=>({gpu_name:'', vram_mb:0, ram_mb:0})})),
|
||||
fetch('/api/v1/ollama/tags').catch(() => ({json: async()=>({models:[]})}))
|
||||
]);
|
||||
const stats = await statsRes.json();
|
||||
const sessions = await sessionsRes.json();
|
||||
const pairs = await pairsRes.json();
|
||||
const hw = await hwRes.json().catch(() => ({gpu_name:'', vram_mb:0, ram_mb:0}));
|
||||
const modelsData = await modelsRes.json().catch(() => ({models:[]}));
|
||||
|
||||
// Versio
|
||||
if (stats.version) document.getElementById('admin-version').textContent = 'v' + stats.version;
|
||||
@@ -230,6 +248,24 @@ async function load() {
|
||||
<td>${p.duration_ms||0}ms</td>
|
||||
</tr>`;
|
||||
}).join('');
|
||||
|
||||
// Hardware
|
||||
document.getElementById('hardware-stats').innerHTML = [
|
||||
{v: hw.gpu_name || '-', l: 'Paikallinen GPU tila'},
|
||||
{v: hw.vram_mb ? hw.vram_mb + ' MB' : '-', l: 'GPU Muisti (VRAM)'},
|
||||
{v: hw.ram_mb ? hw.ram_mb + ' MB' : '-', l: 'RAM'},
|
||||
].map(s => `<div class="stat-card"><div class="val">${s.v}</div><div class="label">${s.l}</div></div>`).join('');
|
||||
|
||||
// Models
|
||||
document.getElementById('models-body').innerHTML = (modelsData.models || []).map(m => {
|
||||
const sizeGb = (m.size / (1024*1024*1024)).toFixed(2) + ' GB';
|
||||
const params = m.details?.parameter_size || '-';
|
||||
return `<tr>
|
||||
<td><strong>${m.name}</strong></td>
|
||||
<td>${sizeGb}</td>
|
||||
<td>${params}</td>
|
||||
</tr>`;
|
||||
}).join('');
|
||||
}
|
||||
|
||||
load();
|
||||
|
||||
Reference in New Issue
Block a user