diff --git a/network-poc/frontend/src/pages/index.astro b/network-poc/frontend/src/pages/index.astro index dfe3717..e087ecc 100644 --- a/network-poc/frontend/src/pages/index.astro +++ b/network-poc/frontend/src/pages/index.astro @@ -1522,8 +1522,14 @@ IMPORTANT: Include get_db() dependency for FastAPI` }, if (!coderWsReady && typeof ensureCoderNode === 'function') { statusDiv.innerHTML = ` → Käynnistetään laskentasolmua...`; await ensureCoderNode(); - // Odotetaan hetki jotta solmu ehtii rekisteröityä hubiin - await new Promise(r => setTimeout(r, 1000)); + // Odotetaan kunnes solmu on varmasti rekisteröitynyt hubiin + for (let i = 0; i < 30 && !coderWsReady; i++) { + await new Promise(r => setTimeout(r, 500)); + } + if (!coderWsReady) { + statusDiv.innerHTML = ` ✗ Laskentasolmun käynnistys epäonnistui`; + return null; + } statusDiv.innerHTML = ` ${model} käsittelee...`; } @@ -3733,15 +3739,6 @@ ${filesHtml} // Odotetaan kunnes Worker on yhdistänyt hubiin await workerStarted; - // Warmup — nyt WS on varmasti auki - if (uiSocket && uiSocket.readyState === 1) { - uiSocket.send(JSON.stringify({ - type: 'user_text', - text: '{"prompt":"warmup","max_tokens":1}', - task_type: 'qwen-coder' - })); - } - if (pendingCodePrompt) { setTimeout(() => { sendCodeToHub(pendingCodePrompt);