3 Commits

Author SHA1 Message Date
Jaakko Vanhala
6e2f85daa8 Lisätty *.log gitignoreen, poistettu native-node.log seurannasta 2026-04-12 07:41:34 +03:00
Jaakko Vanhala
466e61d730 Cache-busting: kipina-node lataus- ja asennusskripti ohittaa välimuistin
StatusBar ja kipina-node-skripti käyttävät ?v=timestamp-parametria
välimuistin ohittamiseen. Binäärin uudelleenlataus oletuksena Y.
deploy-binaries.sh kopioi myös kipina-node-skriptin palvelimelle.
2026-04-12 07:40:33 +03:00
Jaakko Vanhala
5f00582053 UI:n system prompt ja sampling-parametrit välittyvät inferenssiin asti
Frontend lähettää agentin asetukset (system_prompt, temperature, top_k,
max_tokens, repeat_penalty, stop) API:lle. Hub välittää ne solmulle.
Native-node ja Wasm-coder käyttävät välitettyjä arvoja hardkoodattujen
sijaan.
2026-04-12 07:39:41 +03:00
10 changed files with 100 additions and 244 deletions

3
.gitignore vendored
View File

@@ -38,5 +38,8 @@ Cargo.lock
# Ajonaikaiset tietokannat
*.db
# Lokitiedostot
*.log
# Wanha versio
temp/

View File

@@ -22,6 +22,7 @@ echo ""
echo "[Vieminen uuteen kohteeseen...]"
ssh $SSH_OPTS "$SERVER" "mkdir -p $REMOTE_DIR/frontend/dist/download"
scp $SSH_OPTS "$SCRIPT_DIR/frontend/public/download"/kipina-node-* "$SERVER:$REMOTE_DIR/frontend/dist/download/"
scp $SSH_OPTS "$SCRIPT_DIR/frontend/public"/kipina-node "$SERVER:$REMOTE_DIR/frontend/dist/"
# 3. Luvat kuntoon
ssh $SSH_OPTS "$SERVER" "chmod +x $REMOTE_DIR/frontend/dist/download/kipina-node-*"

View File

@@ -103,16 +103,18 @@ fi
BIN_PATH="./kipina-node-bin"
if [ -f "$BIN_PATH" ]; then
echo ""
read -p " Löydettiin vanha kipina-node-bin lokaalisti. Haluatko poistaa sen ja ladata uusimman version? [y/N] " -r DEL_CHOICE
if [[ "$DEL_CHOICE" =~ ^[Yy]$ ]]; then
read -p " Löydettiin vanha kipina-node-bin lokaalisti. Haluatko poistaa sen ja ladata uusimman version? [Y/n] " -r DEL_CHOICE
if [[ "$DEL_CHOICE" =~ ^[Nn]$ ]]; then
echo " ✓ Käytetään lokaalia versiota."
else
rm -f "$BIN_PATH"
echo " ✓ Vanha binääri poistettu."
echo " ✓ Vanha binääri poistettu ja korvataan uudella."
fi
fi
if [ ! -f "$BIN_PATH" ]; then
echo " Ladataan tuorein $BINARY..."
curl -sSL "$BASE_URL/$BINARY" -o "$BIN_PATH"
curl -sSL "$BASE_URL/$BINARY?v=$(date +%s)" -o "$BIN_PATH"
chmod +x "$BIN_PATH"
fi

View File

@@ -40,8 +40,8 @@
<div style="padding:12px;background:var(--bg);border-radius:4px;border-left:3px solid var(--green)">
<div style="color:#e6edf3;font-weight:600;margin-bottom:6px">2. Käynnistä Kipinä-node</div>
<div style="display:flex;gap:6px;align-items:center;margin-bottom:6px">
<code style="flex:1;background:#010409;padding:8px 12px;border-radius:4px;color:var(--green);font-family:'Courier New',monospace;font-size:13px;user-select:all">curl -sSL https://kipina.studio/kipina-node -o kipina-node && chmod +x kipina-node && ./kipina-node</code>
<button onclick="navigator.clipboard.writeText('curl -sSL https://kipina.studio/kipina-node -o kipina-node && chmod +x kipina-node && ./kipina-node');this.textContent='✓';setTimeout(()=>this.textContent='Kopioi',1500)" class="btn btn-green" style="padding:6px 10px">Kopioi</button>
<code style="flex:1;background:#010409;padding:8px 12px;border-radius:4px;color:var(--green);font-family:'Courier New',monospace;font-size:13px;user-select:all">curl -sSL "https://kipina.studio/kipina-node?v=$(date +%s)" -o kipina-node && chmod +x kipina-node && ./kipina-node</code>
<button onclick="navigator.clipboard.writeText('curl -sSL \&quot;https://kipina.studio/kipina-node?v=$(date +%s)\&quot; -o kipina-node && chmod +x kipina-node && ./kipina-node');this.textContent='✓';setTimeout(()=>this.textContent='Kopioi',1500)" class="btn btn-green" style="padding:6px 10px">Kopioi</button>
</div>
<div style="color:#8b949e;font-size:12px">Lataa kielimallin (~2GB) automaattisesti ensimmäisellä kerralla. Ctrl+C pysäyttää.</div>
</div>

View File

@@ -486,7 +486,7 @@ OUTPUT FORMAT:
// === kpnRun: lähettää promptin mallille ===
const activeStreams = {};
async function kpnRun(model, prompt, silent) {
async function kpnRun(model, prompt, silent, agentOpts) {
const taskId = crypto.randomUUID();
const statusDiv = document.createElement('div');
statusDiv.className = 'terminal-line';
@@ -511,10 +511,24 @@ OUTPUT FORMAT:
statusDiv.innerHTML = ` <span style="color:#8b949e">→ <span style="color:var(--accent)">${model}</span> käsittelee...</span>`;
// Rakennetaan pyyntö: agentin asetukset tai globaalit oletukset
const opts = agentOpts || {};
const payload = {
model,
prompt,
task_id: taskId,
system_prompt: opts.systemPrompt || settings.systemPrompt || undefined,
temperature: opts.temperature ?? settings.temperature ?? undefined,
top_k: opts.topK ?? settings.topK ?? undefined,
max_tokens: opts.maxTokens ?? settings.maxTokens ?? undefined,
repeat_penalty: opts.repeatPenalty ?? settings.repeatPenalty ?? undefined,
stop: settings.stopSequences ? settings.stopSequences.split('\\n').filter(Boolean) : undefined,
};
const res = await fetch('/api/v1/chat/completions', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ model, prompt, task_id: taskId }),
body: JSON.stringify(payload),
});
if (res.status === 503 && !wasmNodeStarted) {
@@ -792,7 +806,7 @@ OUTPUT FORMAT:
prompt += fileDef.instructions + '\n';
prompt += 'Adapt the example to match the project description. Import from already written files. Write ONLY the code, no explanations.';
const code = await kpnRun(fileAgent.model, prompt);
const code = await kpnRun(fileAgent.model, prompt, false, fileAgent);
if (!code) {
termLog(` ✗ Keskeytyi (${fileName})`, '#f85149');
return;
@@ -817,7 +831,7 @@ OUTPUT FORMAT:
else explainStep('Uudelleentarkistus', `${tst.name} tarkistaa korjaukset.`);
const reviewPrompt = (tst.prompt ? tst.prompt+'\n\n' : '') + `Review this project:\n\n${currentCode}`;
const review = await kpnRun(tst.model, reviewPrompt);
const review = await kpnRun(tst.model, reviewPrompt, false, tst);
stepN++;
// LGTM → ei korjauksia tarvita
@@ -832,7 +846,7 @@ OUTPUT FORMAT:
explainStep('Korjaus', `${tst.name} löysi ongelmia. ${cdr.name} saa palautteen ja korjaa.`);
const fixPrompt = `${cdr.prompt ? cdr.prompt+'\n\n' : ''}Fix these issues:\n${review}\n\nCurrent code:\n${currentCode}\n\nWrite ALL corrected files. Start each file with: --- filename.py ---`;
const fixedCode = await kpnRun(cdr.model, fixPrompt);
const fixedCode = await kpnRun(cdr.model, fixPrompt, false, cdr);
// Parsitaan korjatut tiedostot takaisin files-objektiin
if (fixedCode) {
@@ -858,7 +872,7 @@ OUTPUT FORMAT:
highlightAgent('qa');
explainStep('Testit', `${qaAgent.name} kirjoittaa pytest-testit korjatulle koodille.`);
const qaPrompt = (qaAgent.prompt ? qaAgent.prompt+'\n\n' : '') + `Write pytest tests for this project:\n\n${updatedCode}\n\nWrite a complete test_main.py file with TestClient.`;
const tests = await kpnRun(qaAgent.model, qaPrompt);
const tests = await kpnRun(qaAgent.model, qaPrompt, false, qaAgent);
if (tests) files['test_main.py'] = tests;
stepN++;
}
@@ -878,7 +892,7 @@ OUTPUT FORMAT:
`- Expose port 8000\n` +
`- CMD: uv run uvicorn main:app --host 0.0.0.0 --port 8000\n` +
`\nWrite ONLY the Dockerfile, no explanations.`;
const dockerfile = await kpnRun(tst.model, dockerPrompt);
const dockerfile = await kpnRun(tst.model, dockerPrompt, false, tst);
if (dockerfile) files['Dockerfile'] = dockerfile;
stepN++;
@@ -913,7 +927,7 @@ OUTPUT FORMAT:
`## Architecture\nDescribe the project structure and design decisions.\n\n` +
`## Risk Assessment\n| Severity | Issue |\n|----------|-------|\n| ... | ... |\n\n` +
`Project code:\n${finalCode}`;
const readme = await kpnRun(obs.model, obsPrompt);
const readme = await kpnRun(obs.model, obsPrompt, false, obs);
if (readme) {
files['README.md'] = readme;
// Tallennetaan raportti globaalisti jotta tarkkailija-klikkaus avaa sen

View File

@@ -1141,6 +1141,16 @@ struct ChatCompletionRequest {
task_id: String,
#[serde(default)]
max_tokens: Option<u64>,
#[serde(default)]
system_prompt: Option<String>,
#[serde(default)]
temperature: Option<f64>,
#[serde(default)]
top_k: Option<u64>,
#[serde(default)]
repeat_penalty: Option<f64>,
#[serde(default)]
stop: Option<Vec<String>>,
}
#[derive(serde::Serialize)]
@@ -1308,9 +1318,13 @@ async fn api_chat_completions(
"model": payload.model,
"task_id": payload.task_id,
});
if let Some(mt) = payload.max_tokens {
msg.as_object_mut().unwrap().insert("max_tokens".to_string(), serde_json::json!(mt));
}
let obj = msg.as_object_mut().unwrap();
if let Some(mt) = payload.max_tokens { obj.insert("max_tokens".to_string(), serde_json::json!(mt)); }
if let Some(ref sp) = payload.system_prompt { obj.insert("system_prompt".to_string(), serde_json::json!(sp)); }
if let Some(t) = payload.temperature { obj.insert("temperature".to_string(), serde_json::json!(t)); }
if let Some(k) = payload.top_k { obj.insert("top_k".to_string(), serde_json::json!(k)); }
if let Some(rp) = payload.repeat_penalty { obj.insert("repeat_penalty".to_string(), serde_json::json!(rp)); }
if let Some(ref s) = payload.stop { obj.insert("stop".to_string(), serde_json::json!(s)); }
// Oneshot-kanava: solmu palauttaa tuloksen suoraan tälle pyynnölle
let (resp_tx, resp_rx) = tokio::sync::oneshot::channel::<serde_json::Value>();

View File

@@ -1,208 +0,0 @@
2026-04-12T02:49:51.405400Z  INFO native_node: Kipinä Native Node käynnistyy — hub: ws://127.0.0.1:3000/ws, varaus: 4 GB
2026-04-12T02:49:51.422359Z  INFO native_node: Järjestelmä: Mac | Darwin 26.3.1 | 12 ydintä | 32768 MB RAM
2026-04-12T02:49:51.437017Z  INFO native_node: GPU 0: Apple M2 Max (Apple) [Metal] | VRAM: ?/24576 MB | ? | kuormitus: ?
2026-04-12T02:49:51.437041Z  INFO native_node: Alustetaan Ollama-yhteyttä...
2026-04-12T02:49:51.441582Z  INFO native_node::inference: Ollama löytyi osoitteesta: http://localhost:11434
2026-04-12T02:50:03.018835Z  INFO native_node: Kipinä Native Node käynnistyy — hub: ws://127.0.0.1:3000/ws, varaus: 4 GB
2026-04-12T02:50:03.036749Z  INFO native_node: Järjestelmä: Mac | Darwin 26.3.1 | 12 ydintä | 32768 MB RAM
2026-04-12T02:50:03.052051Z  INFO native_node: GPU 0: Apple M2 Max (Apple) [Metal] | VRAM: ?/24576 MB | ? | kuormitus: ?
2026-04-12T02:50:03.052084Z  INFO native_node: Alustetaan Ollama-yhteyttä...
2026-04-12T02:50:03.056985Z  INFO native_node::inference: Ollama löytyi osoitteesta: http://localhost:11434
2026-04-12T02:50:14.540287Z  INFO native_node: Kipinä Native Node käynnistyy — hub: ws://127.0.0.1:3000/ws, varaus: 4 GB
2026-04-12T02:50:14.558901Z  INFO native_node: Järjestelmä: Mac | Darwin 26.3.1 | 12 ydintä | 32768 MB RAM
2026-04-12T02:50:14.572180Z  INFO native_node: GPU 0: Apple M2 Max (Apple) [Metal] | VRAM: ?/24576 MB | ? | kuormitus: ?
2026-04-12T02:50:14.572210Z  INFO native_node: Alustetaan Ollama-yhteyttä...
2026-04-12T02:50:14.575891Z  INFO native_node::inference: Ollama löytyi osoitteesta: http://localhost:11434
2026-04-12T02:52:05.405865Z  INFO native_node: Kipinä Native Node käynnistyy — hub: ws://127.0.0.1:3000/ws, varaus: 4 GB
2026-04-12T02:52:05.422571Z  INFO native_node: Järjestelmä: Mac | Darwin 26.3.1 | 12 ydintä | 32768 MB RAM
2026-04-12T02:52:05.433853Z  INFO native_node: GPU 0: Apple M2 Max (Apple) [Metal] | VRAM: ?/24576 MB | ? | kuormitus: ?
2026-04-12T02:52:05.433870Z  INFO native_node: Alustetaan Ollama-yhteyttä...
2026-04-12T02:52:05.437718Z  INFO native_node::inference: Ollama löytyi osoitteesta: http://localhost:11434
2026-04-12T02:52:11.707486Z  INFO native_node::inference: Ollama backend: http://localhost:11434 | malli: qwen2.5-coder:7b-instruct-q4_K_M
2026-04-12T02:52:11.707646Z  INFO native_node::inference: Tarkistetaan malli qwen2.5-coder:7b-instruct-q4_K_M...
2026-04-12T02:52:12.713480Z  INFO native_node::inference: Malli qwen2.5-coder:7b-instruct-q4_K_M valmis
2026-04-12T02:52:12.713706Z  INFO native_node: Ollama valmis inferenssiin!
2026-04-12T02:52:12.713749Z  INFO native_node: Käytettävä kielimalli konfiguroitu (selected_task): qwen2.5-coder:7b-instruct-q4_K_M
2026-04-12T02:52:12.719515Z  INFO native_node: Yhdistetty hubiin!
2026-04-12T02:52:22.800662Z  INFO native_node: Tauotetaan solmun suoritus (Hub ei lähetä tehtäviä)...
2026-04-12T02:52:25.475326Z  INFO native_node: Jatketaan solmun suoritusta...
2026-04-12T02:52:28.692378Z  INFO native_node: Kipinä Native Node käynnistyy — hub: ws://127.0.0.1:3000/ws, varaus: 4 GB
2026-04-12T02:52:28.708978Z  INFO native_node: Järjestelmä: Mac | Darwin 26.3.1 | 12 ydintä | 32768 MB RAM
2026-04-12T02:52:28.723045Z  INFO native_node: GPU 0: Apple M2 Max (Apple) [Metal] | VRAM: ?/24576 MB | ? | kuormitus: ?
2026-04-12T02:52:28.723071Z  INFO native_node: Alustetaan Ollama-yhteyttä...
2026-04-12T02:52:28.728130Z  INFO native_node::inference: Ollama löytyi osoitteesta: http://localhost:11434
2026-04-12T02:52:30.362566Z  INFO native_node::inference: Ollama backend: http://localhost:11434 | malli: qwen2.5-coder:7b-instruct-q4_K_M
2026-04-12T02:52:30.362707Z  INFO native_node::inference: Tarkistetaan malli qwen2.5-coder:7b-instruct-q4_K_M...
2026-04-12T02:52:31.248236Z  INFO native_node::inference: Malli qwen2.5-coder:7b-instruct-q4_K_M valmis
2026-04-12T02:52:31.248469Z  INFO native_node: Ollama valmis inferenssiin!
2026-04-12T02:52:31.248505Z  INFO native_node: Käytettävä kielimalli konfiguroitu (selected_task): qwen2.5-coder:7b-instruct-q4_K_M
2026-04-12T02:52:31.254260Z  INFO native_node: Yhdistetty hubiin!
2026-04-12T02:53:35.385696Z  INFO native_node: Kipinä Native Node käynnistyy — hub: ws://127.0.0.1:3000/ws, varaus: 4 GB
2026-04-12T02:53:35.401489Z  INFO native_node: Järjestelmä: Mac | Darwin 26.3.1 | 12 ydintä | 32768 MB RAM
2026-04-12T02:53:35.412450Z  INFO native_node: GPU 0: Apple M2 Max (Apple) [Metal] | VRAM: ?/24576 MB | ? | kuormitus: ?
2026-04-12T02:53:35.412471Z  INFO native_node: Alustetaan Ollama-yhteyttä...
2026-04-12T02:53:35.416006Z  INFO native_node::inference: Ollama löytyi osoitteesta: http://localhost:11434
2026-04-12T02:53:44.463643Z  INFO native_node::inference: Ollama backend: http://localhost:11434 | malli: qwen2.5-coder:7b-instruct-q4_K_M
2026-04-12T02:53:44.463794Z  INFO native_node::inference: Tarkistetaan malli qwen2.5-coder:7b-instruct-q4_K_M...
2026-04-12T02:53:45.213997Z  INFO native_node::inference: Malli qwen2.5-coder:7b-instruct-q4_K_M valmis
2026-04-12T02:53:45.214232Z  INFO native_node: Ollama valmis inferenssiin!
2026-04-12T02:53:45.214287Z  INFO native_node: Käytettävä kielimalli konfiguroitu (selected_task): qwen2.5-coder:7b-instruct-q4_K_M
2026-04-12T02:53:45.233548Z  INFO native_node: Yhdistetty hubiin!
2026-04-12T02:57:27.480736Z  INFO native_node: Kipinä Native Node käynnistyy — hub: ws://127.0.0.1:3000/ws, varaus: 4 GB
2026-04-12T02:57:27.497388Z  INFO native_node: Järjestelmä: Mac | Darwin 26.3.1 | 12 ydintä | 32768 MB RAM
2026-04-12T02:57:27.508598Z  INFO native_node: GPU 0: Apple M2 Max (Apple) [Metal] | VRAM: ?/24576 MB | ? | kuormitus: ?
2026-04-12T02:57:27.508629Z  INFO native_node: Alustetaan Ollama-yhteyttä...
2026-04-12T02:57:27.512329Z  INFO native_node::inference: Ollama löytyi osoitteesta: http://localhost:11434
2026-04-12T02:57:27.512356Z  INFO native_node::inference: Ollama backend: http://localhost:11434 | malli: qwen2.5-coder:3b
2026-04-12T02:57:27.512365Z  INFO native_node::inference: Tarkistetaan malli qwen2.5-coder:3b...
2026-04-12T02:57:28.357205Z  INFO native_node::inference: Malli qwen2.5-coder:3b valmis
2026-04-12T02:57:28.357432Z  INFO native_node: Ollama valmis inferenssiin!
2026-04-12T02:57:28.357489Z  INFO native_node: Käytettävä kielimalli konfiguroitu (selected_task): qwen2.5-coder:3b
2026-04-12T02:57:28.365906Z  INFO native_node: Yhdistetty hubiin!
2026-04-12T02:57:50.406189Z  INFO native_node: Kipinä Native Node käynnistyy — hub: ws://127.0.0.1:3000/ws, varaus: 4 GB
2026-04-12T02:57:50.423119Z  INFO native_node: Järjestelmä: Mac | Darwin 26.3.1 | 12 ydintä | 32768 MB RAM
2026-04-12T02:57:50.433561Z  INFO native_node: GPU 0: Apple M2 Max (Apple) [Metal] | VRAM: ?/24576 MB | ? | kuormitus: ?
2026-04-12T02:57:50.433582Z  INFO native_node: Alustetaan Ollama-yhteyttä...
2026-04-12T02:57:50.437105Z  INFO native_node::inference: Ollama löytyi osoitteesta: http://localhost:11434
2026-04-12T02:57:54.978974Z  INFO native_node::inference: Ollama backend: http://localhost:11434 | malli: qwen2.5-coder:3b
2026-04-12T02:57:54.979107Z  INFO native_node::inference: Tarkistetaan malli qwen2.5-coder:3b...
2026-04-12T02:57:55.795772Z  INFO native_node::inference: Malli qwen2.5-coder:3b valmis
2026-04-12T02:57:55.796000Z  INFO native_node: Ollama valmis inferenssiin!
2026-04-12T02:57:55.796037Z  INFO native_node: Käytettävä kielimalli konfiguroitu (selected_task): qwen2.5-coder:3b
2026-04-12T02:57:55.800614Z  WARN native_node: Hubiin yhdistäminen epäonnistui: IO error: Connection refused (os error 61) — yritetään uudelleen 5s...
2026-04-12T02:58:00.808617Z  WARN native_node: Hubiin yhdistäminen epäonnistui: IO error: Connection refused (os error 61) — yritetään uudelleen 5s...
2026-04-12T02:58:05.810771Z  WARN native_node: Hubiin yhdistäminen epäonnistui: IO error: Connection refused (os error 61) — yritetään uudelleen 5s...
2026-04-12T02:58:10.813443Z  WARN native_node: Hubiin yhdistäminen epäonnistui: IO error: Connection refused (os error 61) — yritetään uudelleen 5s...
2026-04-12T03:01:16.781321Z  INFO native_node: Kipinä Native Node käynnistyy — hub: ws://127.0.0.1:3000/ws, varaus: 4 GB
2026-04-12T03:01:16.794319Z  INFO native_node: Järjestelmä: Mac | Darwin 26.3.1 | 12 ydintä | 32768 MB RAM
2026-04-12T03:01:16.806165Z  INFO native_node: GPU 0: Apple M2 Max (Apple) [Metal] | VRAM: ?/24576 MB | ? | kuormitus: ?
2026-04-12T03:01:16.806188Z  INFO native_node: Alustetaan Ollama-yhteyttä...
2026-04-12T03:01:16.810275Z  INFO native_node::inference: Ollama löytyi osoitteesta: http://localhost:11434
2026-04-12T03:01:18.325121Z  INFO native_node::inference: Ollama backend: http://localhost:11434 | malli: qwen2.5-coder:3b
2026-04-12T03:01:18.325250Z  INFO native_node::inference: Tarkistetaan malli qwen2.5-coder:3b...
2026-04-12T03:01:20.454444Z  INFO native_node::inference: Malli qwen2.5-coder:3b valmis
2026-04-12T03:01:20.454587Z  INFO native_node: Ollama valmis inferenssiin!
2026-04-12T03:01:20.454618Z  INFO native_node: Käytettävä kielimalli konfiguroitu (selected_task): qwen2.5-coder:3b
2026-04-12T03:01:20.468023Z  INFO native_node: Yhdistetty hubiin!
2026-04-12T03:02:28.510843Z  INFO native_node: Kipinä Native Node käynnistyy — hub: ws://127.0.0.1:3000/ws, varaus: 4 GB
2026-04-12T03:02:28.526577Z  INFO native_node: Järjestelmä: Mac | Darwin 26.3.1 | 12 ydintä | 32768 MB RAM
2026-04-12T03:02:28.539782Z  INFO native_node: GPU 0: Apple M2 Max (Apple) [Metal] | VRAM: ?/24576 MB | ? | kuormitus: ?
2026-04-12T03:02:28.539802Z  INFO native_node: Alustetaan Ollama-yhteyttä...
2026-04-12T03:02:28.545400Z  INFO native_node::inference: Ollama löytyi osoitteesta: http://localhost:11434
2026-04-12T03:02:32.541462Z  INFO native_node::inference: Ollama backend: http://localhost:11434 | malli: qwen2.5-coder:7b-instruct-q4_K_M
2026-04-12T03:02:32.541603Z  INFO native_node::inference: Tarkistetaan malli qwen2.5-coder:7b-instruct-q4_K_M...
2026-04-12T03:02:33.365087Z  INFO native_node::inference: Malli qwen2.5-coder:7b-instruct-q4_K_M valmis
2026-04-12T03:02:33.365313Z  INFO native_node: Ollama valmis inferenssiin!
2026-04-12T03:02:33.365349Z  INFO native_node: Käytettävä kielimalli konfiguroitu (selected_task): qwen2.5-coder:7b-instruct-q4_K_M
2026-04-12T03:02:33.401538Z  INFO native_node: Yhdistetty hubiin!
2026-04-12T03:06:31.660670Z  INFO native_node: Kipinä Native Node käynnistyy — hub: ws://127.0.0.1:3000/ws, varaus: 4 GB
2026-04-12T03:06:31.676386Z  INFO native_node: Järjestelmä: Mac | Darwin 26.3.1 | 12 ydintä | 32768 MB RAM
2026-04-12T03:06:31.690957Z  INFO native_node: GPU 0: Apple M2 Max (Apple) [Metal] | VRAM: ?/24576 MB | ? | kuormitus: ?
2026-04-12T03:06:31.690977Z  INFO native_node: Alustetaan Ollama-yhteyttä...
2026-04-12T03:06:31.696155Z  INFO native_node::inference: Ollama löytyi osoitteesta: http://localhost:11434
2026-04-12T03:06:33.075746Z  INFO native_node::inference: Ollama backend: http://localhost:11434 | malli: qwen2.5-coder:7b-instruct-q4_K_M
2026-04-12T03:06:33.075900Z  INFO native_node::inference: Tarkistetaan malli qwen2.5-coder:7b-instruct-q4_K_M...
2026-04-12T03:06:34.006750Z  INFO native_node::inference: Malli qwen2.5-coder:7b-instruct-q4_K_M valmis
2026-04-12T03:06:34.006975Z  INFO native_node: Ollama valmis inferenssiin!
2026-04-12T03:06:34.007013Z  INFO native_node: Käytettävä kielimalli konfiguroitu (selected_task): qwen2.5-coder:7b-instruct-q4_K_M
2026-04-12T03:06:34.012582Z  INFO native_node: Yhdistetty hubiin!
2026-04-12T03:06:42.497863Z  INFO native_node: → task_id:status-check | 1r prompti | "ping..."
2026-04-12T03:06:46.162703Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 11 tok | 3664ms | 59.1 tok/s
2026-04-12T03:06:49.156537Z  INFO native_node: → task_id:status-check | 1r prompti | "ping..."
2026-04-12T03:06:49.655724Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 20 tok | 499ms | 57.5 tok/s
2026-04-12T03:06:52.299481Z  INFO native_node: → task_id:status-check | 1r prompti | "ping..."
2026-04-12T03:06:52.614573Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 11 tok | 314ms | 59.9 tok/s
2026-04-12T03:07:04.444950Z  INFO native_node: → task_id:f889ae9e-ff18-4867-826a-1399ce39ea11 | 41r prompti | "Adapt the example to match the project description. Import f..."
2026-04-12T03:07:10.060424Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 220 tok | 5615ms | 47.8 tok/s
2026-04-12T03:07:10.065996Z  INFO native_node: → task_id:52aaf7f1-7d6a-48df-9329-702bf4438329 | 64r prompti | "Adapt the example to match the project description. Import f..."
2026-04-12T03:07:13.387062Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 54 tok | 3320ms | 37.3 tok/s
2026-04-12T03:07:13.394231Z  INFO native_node: → task_id:bea80c1b-84f3-4859-8372-a01947a181f5 | 122r prompti | "Adapt the example to match the project description. Import f..."
2026-04-12T03:07:28.815501Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 435 tok | 15420ms | 33.8 tok/s
2026-04-12T03:07:28.849290Z  INFO native_node: → task_id:b33bfb94-5ea3-4483-bea6-6eae2e87f622 | 130r prompti | "Adapt the example to match the project description. Import f..."
2026-04-12T03:07:33.403851Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 73 tok | 4554ms | 36.0 tok/s
2026-04-12T03:07:33.410281Z  INFO native_node: → task_id:c7271b5b-9572-4c2d-b1ca-8573153eb818 | 124r prompti | "dev = "uvicorn main:app --reload"..."
2026-04-12T03:07:36.058218Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 3 tok | 2647ms | 66.7 tok/s
2026-04-12T03:07:36.063363Z  INFO native_node: → task_id:3f197227-4c45-4a17-8980-0f9d523b104a | 126r prompti | "Write a complete test_main.py file with TestClient...."
2026-04-12T03:08:04.081504Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 818 tok | 28017ms | 32.6 tok/s
2026-04-12T03:08:04.089182Z  INFO native_node: → task_id:95ff2b0d-b2e8-483b-83a4-68d7227a4784 | 28r prompti | "Write ONLY the Dockerfile, no explanations...."
2026-04-12T03:08:08.956198Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 127 tok | 4866ms | 33.3 tok/s
2026-04-12T03:08:08.962241Z  INFO native_node: → task_id:70a6888c-1327-462f-81e0-238d75c80e27 | 298r prompti | "CMD ["uv", "run", "uvicorn", "main:app", "--host", "0.0.0.0"..."
2026-04-12T03:08:20.512602Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 170 tok | 11550ms | 31.8 tok/s
2026-04-12T03:10:23.640488Z  INFO native_node: → task_id:status-check | 1r prompti | "ping..."
2026-04-12T03:10:24.016781Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 11 tok | 376ms | 59.8 tok/s
2026-04-12T03:10:28.471504Z  INFO native_node: → task_id:status-check | 1r prompti | "ping..."
2026-04-12T03:10:28.851913Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 11 tok | 380ms | 56.4 tok/s
2026-04-12T03:10:32.080898Z  INFO native_node: → task_id:status-check | 1r prompti | "ping..."
2026-04-12T03:10:32.761760Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 30 tok | 680ms | 56.2 tok/s
2026-04-12T03:10:33.543595Z  INFO native_node: → task_id:status-check | 1r prompti | "ping..."
2026-04-12T03:10:34.155195Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 27 tok | 611ms | 56.8 tok/s
2026-04-12T03:10:37.170032Z  INFO native_node: → task_id:status-check | 1r prompti | "ping..."
2026-04-12T03:10:37.490844Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 11 tok | 320ms | 59.3 tok/s
2026-04-12T03:10:41.071790Z  INFO native_node: → task_id:status-check | 1r prompti | "ping..."
2026-04-12T03:10:41.393921Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 11 tok | 321ms | 58.8 tok/s
2026-04-12T03:10:47.007835Z  INFO native_node: → task_id:status-check | 1r prompti | "ping..."
2026-04-12T03:10:47.352103Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 11 tok | 344ms | 56.9 tok/s
2026-04-12T03:10:55.861324Z  INFO native_node: → task_id:status-check | 1r prompti | "ping..."
2026-04-12T03:10:56.193953Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 11 tok | 332ms | 57.8 tok/s
2026-04-12T03:11:09.557527Z  INFO native_node: → task_id:status-check | 1r prompti | "ping..."
2026-04-12T03:11:09.890235Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 11 tok | 332ms | 58.7 tok/s
2026-04-12T03:11:11.846667Z  INFO native_node: → task_id:status-check | 1r prompti | "ping..."
2026-04-12T03:11:12.166974Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 11 tok | 320ms | 59.8 tok/s
2026-04-12T03:11:22.243681Z  INFO native_node: → task_id:status-check | 1r prompti | "ping..."
2026-04-12T03:11:22.590303Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 11 tok | 346ms | 56.8 tok/s
2026-04-12T03:11:43.577820Z  INFO native_node: → task_id:0d939424-723a-4898-b182-e9959e16abb9 | 41r prompti | "Adapt the example to match the project description. Import f..."
2026-04-12T03:11:50.105047Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 256 tok | 6527ms | 47.0 tok/s
2026-04-12T03:11:50.147446Z  INFO native_node: → task_id:a3492a26-284c-4874-80b6-4aeafdbb5a75 | 69r prompti | "Adapt the example to match the project description. Import f..."
2026-04-12T03:11:53.451037Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 55 tok | 3303ms | 39.0 tok/s
2026-04-12T03:11:53.459737Z  INFO native_node: → task_id:7cc73c11-57a8-4cf2-be31-7302e81d25c7 | 127r prompti | "Adapt the example to match the project description. Import f..."
2026-04-12T03:12:08.447730Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 435 tok | 14987ms | 35.1 tok/s
2026-04-12T03:12:08.455128Z  INFO native_node: → task_id:a7adc096-78b1-4314-93a2-26824e2c6ab1 | 135r prompti | "Adapt the example to match the project description. Import f..."
2026-04-12T03:12:13.297818Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 73 tok | 4842ms | 36.0 tok/s
2026-04-12T03:12:13.308601Z  INFO native_node: → task_id:cda5ff01-e88e-4c58-bf5d-24d7a449b4b2 | 128r prompti | "dev = "uvicorn main:app --reload"..."
2026-04-12T03:12:16.062246Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 3 tok | 2753ms | 70.0 tok/s
2026-04-12T03:12:16.070379Z  INFO native_node: → task_id:8d04d6eb-2439-4038-8ffe-ea37eec8d673 | 128r prompti | "Write a complete test_main.py file with TestClient...."
2026-04-12T03:12:40.311815Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 788 tok | 24240ms | 36.7 tok/s
2026-04-12T03:12:40.348709Z  INFO native_node: → task_id:b112c319-e2ad-4293-8699-4feb4f7cee5e | 30r prompti | "Write ONLY the Dockerfile, no explanations...."
2026-04-12T03:12:45.108493Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 145 tok | 4759ms | 38.6 tok/s
2026-04-12T03:12:45.151914Z  INFO native_node: → task_id:80d8e1cf-d536-4ac4-9577-08fbab53d159 | 295r prompti | "EXPOSE 8000..."
2026-04-12T03:12:55.265794Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 171 tok | 10113ms | 36.7 tok/s
2026-04-12T03:18:26.329119Z  INFO native_node: Kipinä Native Node käynnistyy — hub: ws://127.0.0.1:3000/ws, varaus: 4 GB
2026-04-12T03:18:26.350176Z  INFO native_node: Järjestelmä: Mac | Darwin 26.3.1 | 12 ydintä | 32768 MB RAM
2026-04-12T03:18:26.367757Z  INFO native_node: GPU 0: Apple M2 Max (Apple) [Metal] | VRAM: ?/24576 MB | ? | kuormitus: ?
2026-04-12T03:18:26.367784Z  INFO native_node: Alustetaan Ollama-yhteyttä...
2026-04-12T03:18:26.374430Z  INFO native_node::inference: Ollama löytyi osoitteesta: http://localhost:11434
2026-04-12T03:18:29.330257Z  INFO native_node::inference: Ollama backend: http://localhost:11434 | malli: qwen2.5-coder:7b-instruct-q4_K_M
2026-04-12T03:18:29.330419Z  INFO native_node::inference: Tarkistetaan malli qwen2.5-coder:7b-instruct-q4_K_M...
2026-04-12T03:18:30.297228Z  INFO native_node::inference: Malli qwen2.5-coder:7b-instruct-q4_K_M valmis
2026-04-12T03:18:30.297413Z  INFO native_node: Ollama valmis inferenssiin!
2026-04-12T03:18:30.297502Z  INFO native_node: Käytettävä kielimalli konfiguroitu (selected_task): qwen2.5-coder:7b-instruct-q4_K_M
2026-04-12T03:18:30.304013Z  INFO native_node: Yhdistetty hubiin!
2026-04-12T03:19:02.300905Z  INFO native_node: → task_id:status-check | 1r prompti | "ping..."
2026-04-12T03:19:03.443612Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 11 tok | 1142ms | 58.2 tok/s
2026-04-12T03:19:11.592789Z  INFO native_node: → task_id:3625298a-8cf3-4cfc-b24f-96eb7d8487c3 | 41r prompti | "Adapt the example to match the project description. Import f..."
2026-04-12T03:19:17.955448Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 253 tok | 6362ms | 47.9 tok/s
2026-04-12T03:19:17.965059Z  INFO native_node: → task_id:d8d651b2-2d1b-4652-91c7-0e3d99f12ead | 69r prompti | "Adapt the example to match the project description. Import f..."
2026-04-12T03:19:21.159047Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 54 tok | 3193ms | 40.3 tok/s
2026-04-12T03:19:21.167536Z  INFO native_node: → task_id:fa5f4645-a440-4624-83a6-fb24799d0edc | 127r prompti | "Adapt the example to match the project description. Import f..."
2026-04-12T03:19:35.681742Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 435 tok | 14513ms | 36.2 tok/s
2026-04-12T03:19:35.691591Z  INFO native_node: → task_id:24684ea4-2b1b-41c2-b2b0-068fb4e38483 | 136r prompti | "Adapt the example to match the project description. Import f..."
2026-04-12T03:19:40.236213Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 76 tok | 4544ms | 37.9 tok/s
2026-04-12T03:19:40.244741Z  INFO native_node: → task_id:d4e407e9-a0fd-4b25-b355-317e16851854 | 129r prompti | "dev = "uv run uvicorn main:app --reload"..."
2026-04-12T03:19:43.089356Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 3 tok | 2844ms | 67.8 tok/s
2026-04-12T03:19:43.099954Z  INFO native_node: → task_id:7fa43b8d-8ed1-4f44-be45-bc99619ae74f | 129r prompti | "Write a complete test_main.py file with TestClient...."
2026-04-12T03:20:08.686318Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 773 tok | 25585ms | 34.0 tok/s
2026-04-12T03:20:08.696389Z  INFO native_node: → task_id:98a7c691-29f8-4385-9fe6-389d0edfb404 | 30r prompti | "Write ONLY the Dockerfile, no explanations...."
2026-04-12T03:20:12.560366Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 100 tok | 3863ms | 36.6 tok/s
2026-04-12T03:20:12.569728Z  INFO native_node: → task_id:b95245cb-6c5a-4a8e-b903-40f7471d2e72 | 289r prompti | "CMD ["uv", "run", "uvicorn", "main:app", "--host", "0.0.0.0"..."
2026-04-12T03:20:22.658899Z  INFO native_node: ✓ qwen2.5-coder:7b-instruct-q4_K_M | 174 tok | 10089ms | 36.3 tok/s
2026-04-12T03:21:37.867699Z  INFO native_node: Kipinä Native Node käynnistyy — hub: ws://127.0.0.1:3000/ws, varaus: 4 GB
2026-04-12T03:21:37.879381Z  INFO native_node: Järjestelmä: Mac | Darwin 26.3.1 | 12 ydintä | 32768 MB RAM
2026-04-12T03:21:37.899474Z  INFO native_node: GPU 0: Apple M2 Max (Apple) [Metal] | VRAM: ?/24576 MB | ? | kuormitus: ?
2026-04-12T03:21:37.899494Z  INFO native_node: Alustetaan Ollama-yhteyttä...
2026-04-12T03:21:37.903580Z  INFO native_node::inference: Ollama löytyi osoitteesta: http://localhost:11434
2026-04-12T03:21:48.551879Z  INFO native_node::inference: Ollama backend: http://localhost:11434 | malli: qwen2.5-coder:7b-instruct-q4_K_M
2026-04-12T03:21:48.552045Z  INFO native_node::inference: Tarkistetaan malli qwen2.5-coder:7b-instruct-q4_K_M...
2026-04-12T03:21:49.569609Z  INFO native_node::inference: Malli qwen2.5-coder:7b-instruct-q4_K_M valmis
2026-04-12T03:21:49.569839Z  INFO native_node: Ollama valmis inferenssiin!
2026-04-12T03:21:49.569961Z  INFO native_node: Käytettävä kielimalli konfiguroitu (selected_task): qwen2.5-coder:7b-instruct-q4_K_M
2026-04-12T03:21:49.577531Z  INFO native_node: Yhdistetty hubiin!

View File

@@ -1,6 +1,15 @@
use std::time::Instant;
use std::cell::RefCell;
pub struct GenerateOptions {
pub max_tokens: usize,
pub system_prompt: Option<String>,
pub temperature: Option<f64>,
pub top_k: Option<u64>,
pub repeat_penalty: Option<f64>,
pub stop: Option<Vec<String>>,
}
pub struct LlmEngine {
ollama_url: String,
model: RefCell<String>,
@@ -96,25 +105,34 @@ impl LlmEngine {
}
}
pub async fn generate(&self, prompt: &str, max_tokens: usize) -> Result<GenerateResult, String> {
// System prompt tulee agentin konfiguraatiosta (frontend lähettää sen osana promptia).
// Tässä ei yliajeta sitä — Ollama saa vain prompt-kentän.
pub async fn generate(&self, prompt: &str, opts: &GenerateOptions) -> Result<GenerateResult, String> {
let model = self.model.borrow().clone();
let start = Instant::now();
let resp = self.client.post(format!("{}/api/generate", self.ollama_url))
.json(&serde_json::json!({
let default_stop: Vec<String> = vec![
"<|im_end|>".into(), "\n###".into(), "\nExplanation".into(),
"\nNote:".into(), "\nPlease note".into(), "\nThis is".into(),
"\n```\n\n".into(), "\n// Example".into(), "\n# Example".into(),
];
let mut body = serde_json::json!({
"model": model,
"prompt": prompt,
"stream": false,
"options": {
"num_predict": max_tokens,
"temperature": 0.7,
"top_k": 40,
"repeat_penalty": 1.15,
"stop": ["<|im_end|>", "\n###", "\nExplanation", "\nNote:", "\nPlease note", "\nThis is", "\n```\n\n", "\n// Example", "\n# Example"]
"num_predict": opts.max_tokens,
"temperature": opts.temperature.unwrap_or(0.7),
"top_k": opts.top_k.unwrap_or(40),
"repeat_penalty": opts.repeat_penalty.unwrap_or(1.15),
"stop": opts.stop.as_ref().unwrap_or(&default_stop),
}
}))
});
if let Some(ref sp) = opts.system_prompt {
body.as_object_mut().unwrap().insert("system".to_string(), serde_json::json!(sp));
}
let start = Instant::now();
let resp = self.client.post(format!("{}/api/generate", self.ollama_url))
.json(&body)
.send()
.await
.map_err(|e| format!("Ollama generate: {}", e))?;

View File

@@ -472,7 +472,14 @@ async fn main() {
if !prompt.is_empty() && (msg_model.starts_with("qwen-coder") || msg_model.starts_with("qwen2.5-coder") || msg_model.starts_with("phi")) {
if let Some(ref engine) = llm {
let max_tokens = task.get("max_tokens").and_then(|v| v.as_u64()).unwrap_or(1024) as usize;
let gen_opts = inference::GenerateOptions {
max_tokens: task.get("max_tokens").and_then(|v| v.as_u64()).unwrap_or(1024) as usize,
system_prompt: task.get("system_prompt").and_then(|v| v.as_str()).map(|s| s.to_string()),
temperature: task.get("temperature").and_then(|v| v.as_f64()),
top_k: task.get("top_k").and_then(|v| v.as_u64()),
repeat_penalty: task.get("repeat_penalty").and_then(|v| v.as_f64()),
stop: task.get("stop").and_then(|v| v.as_array()).map(|a| a.iter().filter_map(|s| s.as_str().map(|s| s.to_string())).collect()),
};
let prompt_lines = prompt.lines().count();
let prompt_last: String = prompt.lines().last().unwrap_or("").chars().take(60).collect();
tracing::info!("→ task_id:{} | {}r prompti | \"{}...\"", task_id, prompt_lines, prompt_last);
@@ -480,11 +487,10 @@ async fn main() {
let mut st = tui_state.write().await;
st.cur_task_id = Some(task_id.to_string());
st.cur_prompt = Some(format!("{} riviä | \"{}...\"", prompt_lines, prompt_last));
// Ei login puskemista vielä tässä! Yhdistetään se valmiin lohkoon yhdelle riville.
}
let model_name = engine.model_name();
match engine.generate(prompt, max_tokens).await {
match engine.generate(prompt, &gen_opts).await {
Ok(result) => {
let tokens_sec = (result.tokens_per_sec * 10.0).round() / 10.0;
tracing::info!(

View File

@@ -368,11 +368,17 @@ pub async fn start_agent_node(hub_url: String, has_webgpu: bool, device_info_jso
let _ = ws_clone.borrow().send_with_str(&err_msg.to_string());
}
} else {
// Välitetään parametrit JSON-promptina coderille
let coder_prompt = serde_json::json!({
"prompt": prompt,
"system": task.get("system_prompt").and_then(|v| v.as_str()).unwrap_or(""),
"max_tokens": task.get("max_tokens").and_then(|v| v.as_u64()).unwrap_or(512),
}).to_string();
let use_3b = current_task == 5;
LLM_BUSY.store(true, Ordering::SeqCst);
let ws_for_async = ws_clone.clone();
wasm_bindgen_futures::spawn_local(async move {
qwen_coder::run_coder_inference(prompt, ws_for_async, use_3b, task_id).await;
qwen_coder::run_coder_inference(coder_prompt, ws_for_async, use_3b, task_id).await;
LLM_BUSY.store(false, Ordering::SeqCst);
});
}