diff --git a/network-poc/frontend/src/pages/index.astro b/network-poc/frontend/src/pages/index.astro
index 050bfa3..50b9cea 100644
--- a/network-poc/frontend/src/pages/index.astro
+++ b/network-poc/frontend/src/pages/index.astro
@@ -801,34 +801,50 @@ OUTPUT FORMAT:
const review = await kpnRun(tst.model, tstPrompt);
stepN++;
- // Korjausluuppi (jos tarpeen)
+ // Korjausluuppi (jos tarpeen) — korjatut tiedostot päivitetään files-objektiin
if (review && !review.toLowerCase().includes('lgtm')) {
termLog(`\n[${stepN}] ${esc(cdr.name)} — korjaukset`);
highlightAgent('coder');
- explainStep('Korjausluuppi', `${tst.name} löysi ongelmia. ${cdr.name} saa palautteen ja korjaa koodin.`);
- await kpnRun(cdr.model, `${cdr.prompt ? cdr.prompt+'\n\n' : ''}Fix these issues:\n${review}\n\nCurrent code:\n${allCode}\n\nWrite the corrected files.`);
+ explainStep('Korjausluuppi', `${tst.name} löysi ongelmia. ${cdr.name} korjaa ja palauttaa päivitetyt tiedostot.`);
+ const fixPrompt = `${cdr.prompt ? cdr.prompt+'\n\n' : ''}Fix these issues:\n${review}\n\nCurrent code:\n${allCode}\n\nWrite ALL corrected files. Start each file with: --- filename.py ---`;
+ const fixedCode = await kpnRun(cdr.model, fixPrompt);
+ // Parsitaan korjatut tiedostot takaisin files-objektiin
+ if (fixedCode) {
+ const fixedParts = fixedCode.split(/^---\s*(\S+)\s*---$/m);
+ for (let j = 1; j < fixedParts.length; j += 2) {
+ const fname = fixedParts[j].trim();
+ const fcode = (fixedParts[j+1] || '').trim();
+ if (fname && fcode && files[fname] !== undefined) {
+ files[fname] = fcode;
+ }
+ }
+ }
stepN++;
}
- // QA: testit
+ // Päivitetään allCode korjausten jälkeen
+ const updatedCode = Object.entries(files).map(([n,c]) => `--- ${n} ---\n${c}`).join('\n\n');
+
+ // QA: testit (saa korjatut tiedostot)
const qaAgent = agents.qa || Object.values(agents)[3];
if (qaAgent) {
termLog(`\n[${stepN}] ${esc(qaAgent.name)} — testit`);
highlightAgent('qa');
- explainStep('Testit', `${qaAgent.name} kirjoittaa pytest-testit kaikille endpointeille.`);
- const qaPrompt = (qaAgent.prompt ? qaAgent.prompt+'\n\n' : '') + `Write pytest tests for this project:\n\n${allCode}\n\nWrite a complete test_main.py file with TestClient.`;
+ 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);
if (tests) files['test_main.py'] = tests;
stepN++;
}
- // DevOps: Dockerfile
+ // DevOps: Dockerfile (saa kaikki tiedostot mukaan lukien testit)
+ const allFilesNow = Object.keys(files).join(', ');
termLog(`\n[${stepN}] ${esc(tst.name)} — Dockerfile`);
highlightAgent('tester');
- explainStep('Dockerfile', `${tst.name} generoi Docker-kontin joka pakkaa projektin ajettavaksi.`);
+ explainStep('Dockerfile', `${tst.name} generoi Docker-kontin kaikista ${Object.keys(files).length} tiedostosta: ${allFilesNow}`);
const dockerPrompt = (tst.prompt ? tst.prompt+'\n\n' : '') +
`Write a Dockerfile for this Python FastAPI project.\n\n` +
- `Project files: ${Object.keys(files).join(', ')}\n\n` +
+ `Project files: ${allFilesNow}\n\n` +
`Requirements:\n` +
`- Use python:3.12-slim as base\n` +
`- Install uv: COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv\n` +