Agenttien promptit näkyvissä ja editoitavissa + Aja uudelleen -nappi
Klikkaa agenttia → näet viimeisimmän pipeline-promptin tekstikentässä. Voit editoida promptia ja painaa 'Aja uudelleen' ajamaan sen samalla mallilla. Pipeline tallentaa nyt koko promptin (ei vain kuvausta). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1076,6 +1076,13 @@
|
|||||||
<div id="shared-prompt-section" style="display:none;margin-top:8px;font-size:12px;color:#8b949e">
|
<div id="shared-prompt-section" style="display:none;margin-top:8px;font-size:12px;color:#8b949e">
|
||||||
Yhteinen konteksti liitetään jokaisen valitun agentin oman promptin alkuun.
|
Yhteinen konteksti liitetään jokaisen valitun agentin oman promptin alkuun.
|
||||||
</div>
|
</div>
|
||||||
|
<div id="agent-last-prompt" style="display:none;margin-top:12px;border-top:1px solid var(--border-color);padding-top:10px">
|
||||||
|
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:6px">
|
||||||
|
<span style="font-size:12px;color:#8b949e">Viimeisin pipeline-prompti:</span>
|
||||||
|
<button id="agent-rerun-btn" style="background:#161b22;border:1px solid var(--accent-color);color:var(--accent-color);font-size:11px;padding:2px 10px;border-radius:4px;cursor:pointer">▶ Aja uudelleen</button>
|
||||||
|
</div>
|
||||||
|
<textarea id="agent-last-prompt-text" style="width:100%;background:#010409;border:1px solid var(--border-color);border-radius:4px;color:#c9d1d9;font-size:12px;font-family:'Courier New',monospace;padding:8px;resize:vertical;min-height:80px;outline:none"></textarea>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -1246,6 +1253,24 @@
|
|||||||
textEl.value = sharedPrompt;
|
textEl.value = sharedPrompt;
|
||||||
sharedEl.style.display = 'block';
|
sharedEl.style.display = 'block';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Näytetään viimeisin pipeline-prompti valitulle agentille
|
||||||
|
const lastPromptDiv = document.getElementById('agent-last-prompt');
|
||||||
|
const lastPromptText = document.getElementById('agent-last-prompt-text');
|
||||||
|
if (selectedAgents.size === 1) {
|
||||||
|
const agent = [...selectedAgents][0];
|
||||||
|
const lastStep = [...pipelineSteps].reverse().find(s => s.agent === agent && s.status === 'done' && s.input);
|
||||||
|
if (lastStep) {
|
||||||
|
lastPromptDiv.style.display = 'block';
|
||||||
|
lastPromptText.value = lastStep.input;
|
||||||
|
lastPromptText.dataset.agent = agent;
|
||||||
|
lastPromptText.dataset.label = lastStep.label;
|
||||||
|
} else {
|
||||||
|
lastPromptDiv.style.display = 'none';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
lastPromptDiv.style.display = 'none';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.selectAgent = function(agent) {
|
window.selectAgent = function(agent) {
|
||||||
@@ -1301,7 +1326,18 @@
|
|||||||
clearTimeout(saved._t);
|
clearTimeout(saved._t);
|
||||||
saved._t = setTimeout(() => saved.style.opacity = '0', 1500);
|
saved._t = setTimeout(() => saved.style.opacity = '0', 1500);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// "Aja uudelleen" -nappi: ajaa editoidun promptin samalla agentilla
|
||||||
|
document.getElementById('agent-rerun-btn')?.addEventListener('click', () => {
|
||||||
|
const textEl = document.getElementById('agent-last-prompt-text');
|
||||||
|
const prompt = textEl?.value?.trim();
|
||||||
|
if (!prompt) return;
|
||||||
|
const agent = textEl.dataset.agent;
|
||||||
|
const model = agentPrompts[agent]?.model || 'qwen-coder';
|
||||||
|
termLog(`<span class="terminal-prompt">$</span> <span style="color:#a371f7">↻ Aja uudelleen:</span> ${esc(agent)} — ${esc(prompt.substring(0, 60))}...`);
|
||||||
|
kpnRun(model, prompt);
|
||||||
|
});
|
||||||
|
|
||||||
function checkAgentConfusion() {
|
function checkAgentConfusion() {
|
||||||
Object.keys(agentPrompts).forEach(agent => {
|
Object.keys(agentPrompts).forEach(agent => {
|
||||||
const prompt = agentPrompts[agent].prompt || "";
|
const prompt = agentPrompts[agent].prompt || "";
|
||||||
@@ -2107,8 +2143,6 @@
|
|||||||
termLog(`<span style="color:#a371f7;font-weight:bold">━━━ Pipeline käynnistyy ━━━</span>`);
|
termLog(`<span style="color:#a371f7;font-weight:bold">━━━ Pipeline käynnistyy ━━━</span>`);
|
||||||
|
|
||||||
// Vaihe 1: Manageri pilkkoo projektin tiedostoiksi
|
// Vaihe 1: Manageri pilkkoo projektin tiedostoiksi
|
||||||
termLog(`\n<span style="color:#d29922;font-weight:bold">[1] Manageri</span> — projektin suunnittelu`);
|
|
||||||
pipelineStep('manager', 'Suunnittelu', 'active', task);
|
|
||||||
const managerPrompt = `List the source files needed for this project. One file per line, format:
|
const managerPrompt = `List the source files needed for this project. One file per line, format:
|
||||||
filename.py: one-line description
|
filename.py: one-line description
|
||||||
|
|
||||||
@@ -2121,9 +2155,11 @@ CONSTRAINTS — the coder can only generate ~400 tokens per file:
|
|||||||
- Prefer fewer, focused files over many small ones
|
- Prefer fewer, focused files over many small ones
|
||||||
|
|
||||||
Project: ${task}`;
|
Project: ${task}`;
|
||||||
|
termLog(`\n<span style="color:#d29922;font-weight:bold">[1] Manageri</span> — projektin suunnittelu`);
|
||||||
|
pipelineStep('manager', 'Suunnittelu', 'active', managerPrompt);
|
||||||
const plan = await kpnRun(agentPrompts.manager.model, managerPrompt, false, 200);
|
const plan = await kpnRun(agentPrompts.manager.model, managerPrompt, false, 200);
|
||||||
if (!plan) { termLog(' ✗ Pipeline keskeytyi (manageri)', '#f85149'); return; }
|
if (!plan) { termLog(' ✗ Pipeline keskeytyi (manageri)', '#f85149'); return; }
|
||||||
pipelineStep('manager', 'Suunnittelu', 'done', task, plan);
|
pipelineStep('manager', 'Suunnittelu', 'done', managerPrompt, plan);
|
||||||
|
|
||||||
// Parsitaan tiedostolista: "filename.py: description" TAI pelkkä "filename.py"
|
// Parsitaan tiedostolista: "filename.py: description" TAI pelkkä "filename.py"
|
||||||
const fileList = plan.split('\n')
|
const fileList = plan.split('\n')
|
||||||
@@ -2160,7 +2196,7 @@ Project: ${task}`;
|
|||||||
for (let i = 0; i < fileList.length; i++) {
|
for (let i = 0; i < fileList.length; i++) {
|
||||||
const file = fileList[i];
|
const file = fileList[i];
|
||||||
termLog(`\n<span style="color:#3fb950;font-weight:bold">[${i + 2}] Koodari</span> — ${esc(file.name)}`);
|
termLog(`\n<span style="color:#3fb950;font-weight:bold">[${i + 2}] Koodari</span> — ${esc(file.name)}`);
|
||||||
pipelineStep('coder', file.name, 'active', file.desc);
|
pipelineStep('coder', file.name, 'active', '');
|
||||||
|
|
||||||
// Rakennetaan konteksti: aiemmin generoidut tiedostot
|
// Rakennetaan konteksti: aiemmin generoidut tiedostot
|
||||||
let context = '';
|
let context = '';
|
||||||
@@ -2196,7 +2232,7 @@ IMPORTANT: Keep the code SHORT and focused. Max ~50 lines. No comments, no docst
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
generatedFiles[file.name] = code;
|
generatedFiles[file.name] = code;
|
||||||
pipelineStep('coder', file.name, 'done', file.desc, code);
|
pipelineStep('coder', file.name, 'done', coderPrompt, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vaihe 3: Testaaja arvioi koko projektin
|
// Vaihe 3: Testaaja arvioi koko projektin
|
||||||
|
|||||||
Reference in New Issue
Block a user