diff --git a/network-poc/static/index.html b/network-poc/static/index.html index 0a35d6f..188c0de 100644 --- a/network-poc/static/index.html +++ b/network-poc/static/index.html @@ -3280,6 +3280,9 @@ Write the corrected code.`; document.getElementById('coder-status').textContent = 'Connected'; document.getElementById('coder-status').style.color = '#d29922'; coderWsReady = true; + } else if (e.data.type === 'log') { + // Workerin console.log → pääsäikeen kuuntelijat (tilaindikaattori, pipeline-stepit) + console.log(e.data.message); } else if (e.data.type === 'error') { console.log('[Worker] Virhe: ' + e.data.message); } diff --git a/network-poc/static/worker.js b/network-poc/static/worker.js index 64aec00..f7a14bf 100644 --- a/network-poc/static/worker.js +++ b/network-poc/static/worker.js @@ -3,6 +3,13 @@ import init, { start_agent_node, set_gpu_load, set_auto_tasks } from './pkg/node let wasmReady = false; +// Välitetään console.log -viestit pääsäikeelle jotta UI-kuuntelijat näkevät ne +const _origLog = console.log; +console.log = function(...args) { + _origLog.apply(console, args); + self.postMessage({ type: 'log', message: args.join(' ') }); +}; + self.onmessage = async (e) => { const { type, data } = e.data;