From 3a1c5c723c879f976b28bd9242aaecd6acbda800 Mon Sep 17 00:00:00 2001 From: jaakko Date: Tue, 7 Apr 2026 07:30:39 +0300 Subject: [PATCH] =?UTF-8?q?kpn=20models:=20numerot=20+=20ladattu-tila=20yh?= =?UTF-8?q?ten=C3=A4isess=C3=A4=20listassa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sama lista kuin kpn load, mutta näyttää myös mitkä mallit on ladattu Ollamaan (✓) ja WASM-tilan. Numerot toimivat suoraan kpn load -komennolla. Co-Authored-By: Claude Opus 4.6 (1M context) --- network-poc/static/index.html | 47 ++++++++++++++++------------------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/network-poc/static/index.html b/network-poc/static/index.html index 0050770..0ba6aee 100644 --- a/network-poc/static/index.html +++ b/network-poc/static/index.html @@ -2493,35 +2493,30 @@ Files: ${Object.keys(generatedFiles).join(', ')}`; } if (sub === 'models') { - termLog(' Selain (kpn load 1):', '#c9d1d9'); - const btn = document.getElementById('agent-compute-btn'); - const wasmLoaded = btn?.dataset.state === 'ready'; - termLog(` qwen-coder:0.5b ~990 MB | WASM ~0.4 tok/s${wasmLoaded ? ' ✓ ladattu' : ''}`); - termLog(' Natiivi (Ollama + GPU):', '#c9d1d9'); - // Haetaan Ollamasta ladatut mallit - fetch('/api/v1/hardware').then(r => r.json()).then(hw => { + const allModels = [ + { id: '1', name: 'qwen2.5-coder:0.5b', size: '~400 MB', type: 'selain + Ollama' }, + { id: '2', name: 'qwen2.5-coder:1.5b', size: '~1 GB', type: 'Ollama GPU' }, + { id: '3', name: 'qwen2.5-coder:7b', size: '~4.7 GB', type: 'Ollama GPU' }, + { id: '4', name: 'qwen2.5-coder:14b', size: '~9 GB', type: 'Ollama GPU' }, + { id: '5', name: 'qwen2.5-coder:32b', size: '~20 GB', type: 'Ollama GPU' }, + ]; + // Haetaan ladatut mallit Ollamasta + Promise.all([ + fetch('/api/v1/hardware').then(r => r.json()).catch(() => ({})), + fetch('http://' + window.location.hostname + ':11434/api/tags').then(r => r.json()).catch(() => ({ models: [] })), + ]).then(([hw, ollama]) => { + const loadedNames = (ollama.models || []).map(m => m.name.replace(':latest', '')); + const btn = document.getElementById('agent-compute-btn'); + const wasmLoaded = btn?.dataset.state === 'ready'; if (hw.gpu_name && hw.gpu_name !== 'ei natiivisolmua') { - termLog(` GPU: ${hw.gpu_name} | VRAM: ${Math.round((hw.vram_mb||0)/1024)} GB`); + termLog(` GPU: ${hw.gpu_name} | VRAM: ${Math.round((hw.vram_mb||0)/1024)} GB`); } - }).catch(() => {}); - fetch('http://' + window.location.hostname + ':11434/api/tags').then(r => r.json()).then(data => { - const models = data.models || []; - if (models.length === 0) { - termLog(' Ei ladattuja malleja — kpn load <numero>'); - } else { - for (const m of models) { - const sizeGB = (m.size / 1024 / 1024 / 1024).toFixed(1); - const params = m.details?.parameter_size || '?'; - const quant = m.details?.quantization_level || ''; - termLog(` ${m.name} ${sizeGB} GB | ${params} ${quant}`); - } + termLog(' Mallit (kpn load <numero>):', '#c9d1d9'); + for (const m of allModels) { + const loaded = (m.id === '1' && wasmLoaded) || loadedNames.some(n => m.name.includes(n) || n.includes(m.name.split(':')[1])); + const status = loaded ? ' ✓ ladattu' : ''; + termLog(` ${m.id} ${m.name} ${m.size} | ${m.type}${status}`); } - termLog(' Vaihda: kpn load <numero>', '#8b949e'); - }).catch(() => { - termLog(' qwen2.5-coder:7b ~4.7 GB'); - termLog(' qwen2.5-coder:3b ~1.9 GB'); - termLog(' qwen2.5-coder:1.5b ~1 GB'); - termLog(' Ollama ei saatavilla — näytetään oletuslista'); }); return; }