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');