Status-palkki tunnistaa natiivisolmun: ei enää turhaa Wasm-latausta
Sivulatauksessa tarkistetaan onko hubissa jo laskentasolmu (natiivi/Wasm). Jos on → "Valmis (natiivi)", llmReady=true, ei Wasm-latausta. Jos 503 → Wasm-fallback "Alusta"-napista. Poistettu automaattinen Wasm-käynnistys (ensureNode) sivulatauksessa koska natiivisolmu hoitaa laskennan. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -167,7 +167,7 @@ import AgentBar from "../components/AgentBar.astro";
|
||||
const uiSocket = new WebSocket(wsUrl);
|
||||
window._uiSocket = uiSocket;
|
||||
|
||||
uiSocket.onopen = () => {
|
||||
uiSocket.onopen = async () => {
|
||||
document.getElementById('hub-dot').style.background = '#3fb950';
|
||||
document.getElementById('hub-label').textContent = 'Yhdistetty';
|
||||
document.getElementById('hub-label').style.color = '#3fb950';
|
||||
@@ -177,6 +177,31 @@ import AgentBar from "../components/AgentBar.astro";
|
||||
platform: navigator.platform || '', cpu_cores: navigator.hardwareConcurrency || 0,
|
||||
device_memory_gb: navigator.deviceMemory || 0, allocated_gb: 0, selected_task: 'viewer',
|
||||
}));
|
||||
// Tarkistetaan onko natiivisolmu jo hubissa
|
||||
try {
|
||||
const res = await fetch('/api/v1/chat/completions', {
|
||||
method: 'POST', headers: {'Content-Type':'application/json'},
|
||||
body: JSON.stringify({ model: 'qwen-coder', prompt: 'ping', task_id: 'status-check' }),
|
||||
signal: AbortSignal.timeout(3000),
|
||||
});
|
||||
if (res.status !== 503) {
|
||||
// Solmu löytyi (natiivi tai Wasm)
|
||||
document.getElementById('compute-dot').style.background = '#3fb950';
|
||||
document.getElementById('compute-label').textContent = 'Valmis (natiivi)';
|
||||
document.getElementById('compute-label').style.color = '#3fb950';
|
||||
document.getElementById('compute-btn').textContent = '✓ Valmis';
|
||||
document.getElementById('compute-btn').className = 'btn btn-green';
|
||||
llmReady = true;
|
||||
}
|
||||
} catch(e) {
|
||||
// Timeout = solmu on olemassa mutta laskee — se on ok
|
||||
document.getElementById('compute-dot').style.background = '#3fb950';
|
||||
document.getElementById('compute-label').textContent = 'Valmis (natiivi)';
|
||||
document.getElementById('compute-label').style.color = '#3fb950';
|
||||
document.getElementById('compute-btn').textContent = '✓ Valmis';
|
||||
document.getElementById('compute-btn').className = 'btn btn-green';
|
||||
llmReady = true;
|
||||
}
|
||||
};
|
||||
uiSocket.onclose = () => {
|
||||
document.getElementById('hub-dot').style.background = '#f85149';
|
||||
@@ -277,10 +302,7 @@ import AgentBar from "../components/AgentBar.astro";
|
||||
ensureNode();
|
||||
});
|
||||
|
||||
// Autostart
|
||||
if (localStorage.getItem('kpn-coder-loaded') === 'true') {
|
||||
setTimeout(() => ensureNode(), 300);
|
||||
}
|
||||
// Wasm-autostart vain jos natiivisolmua ei löydy (tarkistetaan onopen:ssa)
|
||||
|
||||
// === kpnRun: lähettää promptin mallille ===
|
||||
const activeStreams = {};
|
||||
|
||||
Reference in New Issue
Block a user