Per-agentti sampling-parametrit: temperature, top-k, max tokens, repetition penalty
Jokainen agentti saa omat parametrit jotka näkyvät avatarin konfigurointipaneelissa: - Temperature: Manageri 0.5 (tarkka), Koodari 0.7, Testaaja 0.3 (deterministinen) - Max tokens: Manageri 512, Koodari 1024, Testaaja 512 - Top-K ja Repetition penalty per agentti - Sliderit reaaliaikaisilla arvoilla Parametrit tallentuvat localStorageen agentin mukana. Perustelut: manageri ja testaaja hyötyvät matalasta temperaturesta (determinismi tärkeää), koodari tarvitsee enemmän tokeneita ja hieman korkeamman temperaturen luovempiin ratkaisuihin. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -41,7 +41,34 @@
|
||||
<!-- System prompt -->
|
||||
<div style="margin-bottom:10px">
|
||||
<label style="font-size:12px;color:#8b949e;display:block;margin-bottom:4px">System prompt</label>
|
||||
<textarea id="config-prompt" rows="4" style="width:100%;background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:4px;padding:8px;font-size:13px;font-family:inherit;resize:vertical" placeholder="Kuvaa agentin rooli ja käyttäytyminen..."></textarea>
|
||||
<textarea id="config-prompt" rows="4" style="width:100%;background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:4px;padding:8px;font-size:13px;font-family:'Courier New',monospace;resize:vertical" placeholder="Kuvaa agentin rooli ja käyttäytyminen..."></textarea>
|
||||
</div>
|
||||
|
||||
<!-- Sampling-parametrit -->
|
||||
<div style="margin-bottom:10px">
|
||||
<label style="font-size:12px;color:#8b949e;display:block;margin-bottom:8px">Sampling-parametrit</label>
|
||||
<div style="display:grid;grid-template-columns:1fr 1fr;gap:10px">
|
||||
<div>
|
||||
<label style="font-size:11px;color:#8b949e">Temperature <span id="config-temp-val" style="color:var(--accent);float:right">0.7</span></label>
|
||||
<input type="range" id="config-temperature" min="0" max="1.5" step="0.1" value="0.7" style="width:100%;accent-color:var(--accent)">
|
||||
<div style="font-size:10px;color:#30363d">0=tarkka · 0.7=oletus · 1.5=luova</div>
|
||||
</div>
|
||||
<div>
|
||||
<label style="font-size:11px;color:#8b949e">Max tokens <span id="config-maxtok-val" style="color:var(--accent);float:right">1024</span></label>
|
||||
<input type="range" id="config-maxtokens" min="64" max="4096" step="64" value="1024" style="width:100%;accent-color:var(--accent)">
|
||||
<div style="font-size:10px;color:#30363d">Vastauksen maksimipituus</div>
|
||||
</div>
|
||||
<div>
|
||||
<label style="font-size:11px;color:#8b949e">Top-K <span id="config-topk-val" style="color:var(--accent);float:right">40</span></label>
|
||||
<input type="range" id="config-topk" min="1" max="100" step="1" value="40" style="width:100%;accent-color:var(--accent)">
|
||||
<div style="font-size:10px;color:#30363d">1=greedy · 40=oletus · 100=laaja</div>
|
||||
</div>
|
||||
<div>
|
||||
<label style="font-size:11px;color:#8b949e">Repetition penalty <span id="config-rep-val" style="color:var(--accent);float:right">1.15</span></label>
|
||||
<input type="range" id="config-repeat" min="1.0" max="2.0" step="0.05" value="1.15" style="width:100%;accent-color:var(--accent)">
|
||||
<div style="font-size:10px;color:#30363d">1.0=ei · 1.15=oletus · 2.0=vahva</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Pipeline-järjestys -->
|
||||
|
||||
@@ -62,33 +62,39 @@ import Settings from "../components/Settings.astro";
|
||||
// === Globaalit tilat ===
|
||||
const defaultAgents = {
|
||||
manager: { name: 'Manageri', avatar: '/avatars/karhunpentu.png', model: 'qwen-coder', order: 0,
|
||||
temperature: 0.5, topK: 40, repeatPenalty: 1.15, maxTokens: 512,
|
||||
prompt: `You are a senior project manager and software architect.
|
||||
Break the project into individual source files. List dependencies first (models before app).
|
||||
Use pyproject.toml for Python dependencies (not requirements.txt).
|
||||
Max 4-5 files. Only filenames, no directories. Format: filename.py: description` },
|
||||
coder: { name: 'Koodari', avatar: '/avatars/kipina_notext.png', model: 'qwen-coder', order: 1,
|
||||
temperature: 0.7, topK: 40, repeatPenalty: 1.15, maxTokens: 1024,
|
||||
prompt: `You are an expert Python/Rust developer. Write complete, working code with ALL necessary imports.
|
||||
Use separate names for Pydantic schemas (e.g. UserCreate, UserResponse) and SQLAlchemy models (e.g. User).
|
||||
Always import from other project files when they exist (e.g. from models import User, SessionLocal).
|
||||
Use modern Python: type hints, async/await for FastAPI, f-strings.
|
||||
No explanations, no comments unless complex logic. Only code.` },
|
||||
data: { name: 'Data', avatar: '/avatars/pesukarhu_notext.png', model: 'qwen-coder', order: 2,
|
||||
temperature: 0.5, topK: 40, repeatPenalty: 1.15, maxTokens: 1024,
|
||||
prompt: `You are a database architect and data engineer.
|
||||
Design normalized schemas with proper relationships, indexes, and constraints.
|
||||
Use SQLAlchemy ORM. Define engine, SessionLocal, and Base in a shared database.py.
|
||||
Include migration-friendly patterns. Write complete code with all imports.` },
|
||||
qa: { name: 'QA', avatar: '/avatars/susi_notext.png', model: 'qwen-coder', order: 3,
|
||||
temperature: 0.4, topK: 40, repeatPenalty: 1.15, maxTokens: 1024,
|
||||
prompt: `You are a QA engineer specializing in automated testing.
|
||||
Write pytest tests covering happy paths, edge cases, and error handling.
|
||||
Test API endpoints with TestClient. Mock external dependencies.
|
||||
Verify status codes, response schemas, and database state after operations.` },
|
||||
tester: { name: 'DevOps', avatar: '/avatars/laiskiainen_notext.png', model: 'qwen-coder', order: 4,
|
||||
temperature: 0.3, topK: 40, repeatPenalty: 1.1, maxTokens: 512,
|
||||
prompt: `You are a code reviewer and DevOps engineer.
|
||||
Review code for: missing imports, name conflicts, unhandled errors, security issues.
|
||||
Check that all files are consistent (imports match exports).
|
||||
If code is correct, say "LGTM". Otherwise list specific issues with file:line references.
|
||||
Be brief and actionable.` },
|
||||
observer: { name: 'Tarkkailija', avatar: '/avatars/aikuinen_susi.png', model: 'qwen-coder', order: 5,
|
||||
temperature: 0.6, topK: 40, repeatPenalty: 1.15, maxTokens: 512,
|
||||
prompt: `You are an independent technical observer and risk analyst.
|
||||
Monitor the team output for: architectural issues, security vulnerabilities, missing error handling,
|
||||
inconsistent patterns, and scope creep. Flag critical risks immediately.
|
||||
@@ -151,6 +157,21 @@ Provide a brief risk assessment with severity (low/medium/high/critical).` },
|
||||
document.getElementById('config-model').value = a.model;
|
||||
document.getElementById('config-prompt').value = a.prompt || '';
|
||||
|
||||
// Sampling-parametrit
|
||||
const tempEl = document.getElementById('config-temperature');
|
||||
const tempValEl = document.getElementById('config-temp-val');
|
||||
const maxtokEl = document.getElementById('config-maxtokens');
|
||||
const maxtokValEl = document.getElementById('config-maxtok-val');
|
||||
const topkEl = document.getElementById('config-topk');
|
||||
const topkValEl = document.getElementById('config-topk-val');
|
||||
const repEl = document.getElementById('config-repeat');
|
||||
const repValEl = document.getElementById('config-rep-val');
|
||||
|
||||
tempEl.value = a.temperature ?? 0.7; tempValEl.textContent = tempEl.value;
|
||||
maxtokEl.value = a.maxTokens ?? 1024; maxtokValEl.textContent = maxtokEl.value;
|
||||
topkEl.value = a.topK ?? 40; topkValEl.textContent = topkEl.value;
|
||||
repEl.value = a.repeatPenalty ?? 1.15; repValEl.textContent = repEl.value;
|
||||
|
||||
// Pipeline-järjestys
|
||||
const pipeline = document.getElementById('config-pipeline');
|
||||
const sorted = Object.entries(agents).sort((a,b) => (a[1].order||0) - (b[1].order||0));
|
||||
@@ -162,6 +183,10 @@ Provide a brief risk assessment with severity (low/medium/high/critical).` },
|
||||
document.getElementById('config-name').oninput = () => { agents[key].name = document.getElementById('config-name').value; saveAgents(); renderAgentBar(); };
|
||||
document.getElementById('config-model').onchange = () => { agents[key].model = document.getElementById('config-model').value; saveAgents(); };
|
||||
document.getElementById('config-prompt').oninput = () => { agents[key].prompt = document.getElementById('config-prompt').value; saveAgents(); };
|
||||
tempEl.oninput = () => { agents[key].temperature = +tempEl.value; tempValEl.textContent = tempEl.value; saveAgents(); };
|
||||
maxtokEl.oninput = () => { agents[key].maxTokens = +maxtokEl.value; maxtokValEl.textContent = maxtokEl.value; saveAgents(); };
|
||||
topkEl.oninput = () => { agents[key].topK = +topkEl.value; topkValEl.textContent = topkEl.value; saveAgents(); };
|
||||
repEl.oninput = () => { agents[key].repeatPenalty = +repEl.value; repValEl.textContent = repEl.value; saveAgents(); };
|
||||
};
|
||||
|
||||
window.closeAgentConfig = function() { selectedAgent = null; document.getElementById('agent-config').style.display = 'none'; renderAgentBar(); };
|
||||
|
||||
Reference in New Issue
Block a user