diff --git a/network-poc/static/index.html b/network-poc/static/index.html index bffe3ec..1b68594 100644 --- a/network-poc/static/index.html +++ b/network-poc/static/index.html @@ -1878,11 +1878,15 @@ // Vaihe 1: Manageri pilkkoo projektin tiedostoiksi termLog(`\n[1] Manageri — projektin suunnittelu`); pipelineStep('manager', 'Suunnittelu', 'active', task); - const managerPrompt = `You are a project manager. Break this task into individual source files. -For each file, write one line: FILENAME: description -List only the essential files (max 5). No explanations. + const managerPrompt = `List the source files needed for this project. One file per line, format: +filename.py: what this file contains -Task: ${task}`; +Rules: +- Max 4 files +- Only .py, .txt, .json, .html files +- No directories, no paths, just filenames + +Project: ${task}`; const plan = await kpnRun(agentPrompts.manager.model, managerPrompt); if (!plan) { termLog(' ✗ Pipeline keskeytyi (manageri)', '#f85149'); return; } pipelineStep('manager', 'Suunnittelu', 'done', task, plan); @@ -1890,12 +1894,17 @@ Task: ${task}`; // Parsitaan tiedostolista: "FILENAME: description" -rivit const fileList = plan.split('\n') .map(line => line.trim()) - .filter(line => line.includes(':') && (line.includes('.') || line.includes('/'))) + .filter(line => line.includes(':')) .map(line => { - const [name, ...desc] = line.replace(/^[\d\.\-\*]+\s*/, '').split(':'); - return { name: name.trim().replace(/\*+/g, ''), desc: desc.join(':').trim() }; + const [name, ...desc] = line.replace(/^[\d\.\-\*\s]+/, '').split(':'); + return { name: name.trim().replace(/\*+/g, '').replace(/`/g, ''), desc: desc.join(':').trim() }; }) - .filter(f => f.name.length > 0 && f.name.length < 50); + .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.) + }); if (fileList.length === 0) { // Fallback: manageri ei tuottanut tiedostolistaa, käytetään koko vastausta ohjeena @@ -1926,8 +1935,10 @@ Task: ${task}`; ).join('\n\n') + '\n\n'; } - const coderPrompt = `${context}Write ONLY the file "${file.name}": ${file.desc} -Project: ${task}`; + const coderPrompt = `${context}Project: ${task} +Write ONLY the file "${file.name}". +Purpose: ${file.desc} +Write correct, working code. No explanations.`; const code = await kpnRun(agentPrompts.coder.model, coderPrompt); if (!code) { termLog(` ✗ Pipeline keskeytyi (${file.name})`, '#f85149');