diff --git a/network-poc/frontend/src/components/AgentBar.astro b/network-poc/frontend/src/components/AgentBar.astro index 18868f9..f6a1f3a 100644 --- a/network-poc/frontend/src/components/AgentBar.astro +++ b/network-poc/frontend/src/components/AgentBar.astro @@ -39,32 +39,32 @@ -
- - +
+ +
-
- +
+
0=tarkka · 0.7=oletus · 1.5=luova
-
- +
+
Vastauksen maksimipituus
-
- +
+
1=greedy · 40=oletus · 100=laaja
-
- +
+
1.0=ei · 1.15=oletus · 2.0=vahva
diff --git a/network-poc/frontend/src/pages/index.astro b/network-poc/frontend/src/pages/index.astro index 2b7db44..62b40a5 100644 --- a/network-poc/frontend/src/pages/index.astro +++ b/network-poc/frontend/src/pages/index.astro @@ -63,42 +63,105 @@ import Settings from "../components/Settings.astro"; 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` }, + prompt: `You are a senior project manager and software architect. Your job is to plan the file structure of a software project. + +RULES: +- List each source file on its own line in format: filename.py: one-line description +- List dependency files FIRST (models.py, schemas.py before main.py) +- Use pyproject.toml for Python dependencies (never requirements.txt) +- Maximum 4-5 files per project +- Only filenames, no directory paths +- Common patterns: models.py → schemas.py → main.py → pyproject.toml + +EXAMPLE OUTPUT: +models.py: SQLAlchemy database models and engine setup +schemas.py: Pydantic request/response schemas +main.py: FastAPI application with CRUD endpoints +pyproject.toml: project dependencies` }, 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.` }, + prompt: `You are an expert Python developer. Write complete, production-ready code. + +CRITICAL RULES: +1. Include ALL imports at the top of every file +2. Import from other project files: from models import User, SessionLocal +3. Pydantic schemas use different names than SQLAlchemy models: UserCreate, UserResponse (not User) +4. SQLAlchemy engine: create_engine(url, connect_args={"check_same_thread": False}) +5. SessionLocal: sessionmaker(autocommit=False, autoflush=False, bind=engine) +6. FastAPI dependencies: def get_db(): db = SessionLocal(); try: yield db; finally: db.close() +7. Pydantic v2: use model_dump() not dict(), class Config: from_attributes = True +8. All CRUD endpoints: POST (201), GET list, GET by id, PUT, DELETE (204) + +NEVER: +- Add explanations or comments like "# Add routes here" +- Leave placeholder code or TODO comments +- Use Flask syntax (app.run) in FastAPI projects +- Forget to import from other project files` }, 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.` }, + prompt: `You are a database architect specializing in SQLAlchemy and relational databases. + +YOUR RESPONSIBILITIES: +1. Design normalized database schemas with proper column types and constraints +2. Define SQLAlchemy models with __tablename__, primary keys, indexes, and relationships +3. Set up engine, SessionLocal, and Base in the same file (models.py or database.py) +4. Use String(length) not bare String for SQLite compatibility +5. Add nullable=False for required fields, unique=True where appropriate +6. Use Column(Integer, primary_key=True, index=True) for IDs + +ALWAYS INCLUDE: +- from sqlalchemy import create_engine, Column, Integer, String +- from sqlalchemy.ext.declarative import declarative_base +- from sqlalchemy.orm import sessionmaker +- DATABASE_URL, engine, SessionLocal, Base` }, 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.` }, + prompt: `You are a QA engineer writing automated tests. + +WRITE TESTS USING: +- pytest as the test framework +- FastAPI TestClient for API endpoint testing +- SQLAlchemy in-memory SQLite for test database isolation + +TEST STRUCTURE: +1. test_create: POST valid data → 201, verify response matches input +2. test_list: GET collection → 200, verify array response +3. test_get_by_id: GET with valid/invalid ID → 200/404 +4. test_update: PUT with valid data → 200, verify changes persisted +5. test_delete: DELETE → 204, verify GET returns 404 after + +ALWAYS: from fastapi.testclient import TestClient` }, 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.` }, + prompt: `You are a strict code reviewer. Review the provided code and check for these issues: + +CHECKLIST: +1. ✓ All imports exist (no missing "from X import Y") +2. ✓ Import names match: if models.py exports "User", main.py imports "User" (not "UserModel") +3. ✓ Pydantic schema names don't conflict with SQLAlchemy model names +4. ✓ All CRUD endpoints have error handling (404 for not found) +5. ✓ Database session is properly closed (get_db with yield + finally) +6. ✓ Response models are specified for type safety +7. ✓ No placeholder comments like "# Add routes here" + +RESPOND: +- If all checks pass: "LGTM" +- If issues found: list each as "ISSUE: filename.py: description" +- Be specific and actionable, not vague` }, 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. -Provide a brief risk assessment with severity (low/medium/high/critical).` }, + +EVALUATE THE PROJECT FOR: +1. ARCHITECTURE: Is the file structure logical? Are responsibilities separated? +2. SECURITY: SQL injection risks? Input validation? Authentication? +3. RELIABILITY: Error handling? Database connection management? Edge cases? +4. MAINTAINABILITY: Consistent naming? Clear code structure? Would a new developer understand this? + +OUTPUT FORMAT: +- RISK: [critical/high/medium/low] Description +- List max 3-5 most important findings +- End with overall assessment: "SHIP IT" or "NEEDS WORK: reason"` }, }; let agents = JSON.parse(localStorage.getItem('kpn-agents') || 'null') || JSON.parse(JSON.stringify(defaultAgents)); function saveAgents() { localStorage.setItem('kpn-agents', JSON.stringify(agents)); }