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:
@@ -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