From 4cb6128a2783d42ef0f64dbddde3bdff6bc733bc Mon Sep 17 00:00:00 2001 From: Jaakko Vanhala Date: Sun, 5 Apr 2026 20:44:16 +0300 Subject: [PATCH] =?UTF-8?q?Tiedostoparsinta:=20hyv=C3=A4ksyy=20my=C3=B6s?= =?UTF-8?q?=20pelk=C3=A4t=20tiedostonimet=20ilman=20kuvausta?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Manageri tuottaa toisinaan pelkän listan (app.py, requirements.txt) ilman "filename: description" -formaattia. Parsija hyväksyy nyt molemmat. Koodarin prompti vahvistettu: "Use the exact libraries mentioned in the project description" estää Flaskiin vaihtamisen kun tehtävä sanoo FastAPI. Co-Authored-By: Claude Opus 4.6 (1M context) --- network-poc/static/index.html | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/network-poc/static/index.html b/network-poc/static/index.html index 7d86d18..da11962 100644 --- a/network-poc/static/index.html +++ b/network-poc/static/index.html @@ -2033,26 +2033,28 @@ Project: ${task}`; if (!plan) { termLog(' ✗ Pipeline keskeytyi (manageri)', '#f85149'); return; } pipelineStep('manager', 'Suunnittelu', 'done', task, plan); - // Parsitaan tiedostolista: "FILENAME: description" -rivit + // Parsitaan tiedostolista: "filename.py: description" TAI pelkkä "filename.py" const fileList = plan.split('\n') - .map(line => line.trim()) - .filter(line => line.includes(':')) + .map(line => line.trim().replace(/^[\d\.\-\*\s]+/, '').replace(/\*+/g, '').replace(/`/g, '')) .map(line => { - const [name, ...desc] = line.replace(/^[\d\.\-\*\s]+/, '').split(':'); - return { name: name.trim().replace(/\*+/g, '').replace(/`/g, ''), desc: desc.join(':').trim() }; + if (line.includes(':')) { + const [name, ...desc] = line.split(':'); + return { name: name.trim(), desc: desc.join(':').trim() }; + } + // Pelkkä tiedostonimi ilman kuvausta + return { name: line.trim(), desc: '' }; }) .filter(f => { - // Tiedostonimen pitää sisältää piste + tunniste, ei polkuja const n = f.name; return n.length > 0 && n.length < 40 && !n.includes('/') && !n.includes(' ') - && /\.\w{1,5}$/.test(n); // Päättyy tiedostopäätteeseen (.py, .txt, .json jne.) + && /\.\w{1,5}$/.test(n); }); if (fileList.length === 0) { // Fallback: manageri ei tuottanut tiedostolistaa, käytetään koko vastausta ohjeena termLog(' Ei tiedostojakoa — generoidaan yhtenä kokonaisuutena'); termLog(`\n[2] Koodari — toteutus`); - const code = await kpnRun(agentPrompts.coder.model, `${plan}\n\nWrite the code.`); + const code = await kpnRun(agentPrompts.coder.model, `Project: ${task}\nFiles: ${plan}\n\nWrite all the code for this project. Use the exact libraries mentioned in the project description.`); if (code) { termLog(`\n━━━ Pipeline valmis ━━━`); } @@ -2078,9 +2080,8 @@ Project: ${task}`; } const coderPrompt = `${context}Project: ${task} -Write ONLY the file "${file.name}". -Purpose: ${file.desc} -Write correct, working code. No explanations.`; +Write ONLY the file "${file.name}"${file.desc ? ': ' + file.desc : ''}. +Use the exact libraries mentioned in the project description. Write correct, working code.`; const code = await kpnRun(agentPrompts.coder.model, coderPrompt); if (!code) { termLog(` ✗ Pipeline keskeytyi (${file.name})`, '#f85149');