Isomman qwen-mallin lataus

This commit is contained in:
2026-04-06 13:40:19 +03:00
parent 3976bb6251
commit 99b011e399
2 changed files with 500 additions and 1 deletions

View File

@@ -2552,7 +2552,7 @@ Write the corrected code.`;
uiSocket.onmessage = (event) => {
try {
const raw = event.data;
if (raw.includes('"single_tokenize"') || raw.includes('"download_progress"')) return;
if (raw.includes('"single_tokenize"')) return;
const data = JSON.parse(raw);
if (data.type === "stats") {
@@ -2577,6 +2577,24 @@ Write the corrected code.`;
} else {
dlBar.style.display = 'none';
}
// Terminaaliin latauksen edistyminen
const term = document.getElementById('agent-terminal');
if (term) {
let dlLine = term.querySelector('.term-download');
if (data.pct >= 100) {
if (dlLine) dlLine.remove();
termLog(` <span style="color:#3fb950">✓</span> ${data.file} ladattu`, '#a5d6ff');
} else {
if (!dlLine) {
dlLine = document.createElement('div');
dlLine.className = 'terminal-line term-download';
term.appendChild(dlLine);
}
const bar = '█'.repeat(Math.floor(data.pct / 5)) + '░'.repeat(20 - Math.floor(data.pct / 5));
dlLine.innerHTML = ` <span style="color:#d29922">${data.file}</span> <span style="color:#8b949e">${bar}</span> <span style="color:#58a6ff">${data.pct}%</span> <span style="color:#8b949e">${data.loaded_mb}/${data.total_mb} MB</span>`;
term.scrollTop = term.scrollHeight;
}
}
} else if (data.type === "single_tokenize_done") {
chatBox.classList.remove('hidden');
const r = data.result || {};
@@ -3160,6 +3178,12 @@ Write the corrected code.`;
if (cl) { cl.textContent = 'Qwen2.5-Coder:' + (coderSize === '3b' ? '3B' : '0.5B'); cl.style.color = '#3fb950'; cl.title = sizeLabel + ' · Candle Wasm · CPU · max 512 tok'; }
if (btn) { btn.dataset.state = 'ready'; btn.textContent = '✓ Valmis'; btn.style.borderColor = '#3fb950'; btn.style.color = '#3fb950'; btn.style.cursor = 'default'; btn.title = 'Kielimalli ladattu — oma kone on valmis laskentaan'; }
localStorage.setItem('kpn-coder-loaded', 'true');
// Terminaaliin valmis-viesti
const term = document.getElementById('agent-terminal');
if (term) {
const sLabel = coderSize === '3b' ? 'Qwen2.5-Coder:3B' : 'Qwen2.5-Coder:0.5B';
termLog(` <span style="color:#3fb950">✓</span> ${sLabel} valmis — kpn run coder "prompti"`, '#3fb950');
}
}
if (msg.includes('[Coder]') && msg.includes('Syöte:')) {
// Pipeline piiloon kun generointi alkaa