Agents: CRUD, DB table, session binding, replace model picker

- agents table with name, avatar, description, model, persona, instructions, soft-delete
- AgentEndpoint (GET/POST/PUT/DELETE /api/agents)
- sessions + chains now reference agent_id
- ChatEndpoint resolves agent from session (no agent = no chat)
- system prompt built from agent persona + instructions
- frontend: agent editor with avatar upload, agent cards on dashboard
- session: agent dropdown replaces model picker, choice persisted
This commit is contained in:
Meleki committed 2026-02-26 20:59:19 +01:00
1 parent 0cd2d51d32
commit 449c872296
16 files changed
+552 -46

No files matched your search

+28 -9
View File
@@ -52,10 +52,7 @@
<header class="session-header">
<button class="back-btn" data-page="dashboard">←</button>
<h1 id="sessionTitle" class="editable-title">Session</h1>
<select id="model">
<option value="sonnet">Sonnet 4.6</option>
<option value="opus">Opus 4.6</option>
</select>
<select id="agentSelect"></select>
<button class="header-btn" id="archiveBtn">Archivieren</button>
<div class="toggle">
<input type="checkbox" id="showSystem">
@@ -76,12 +73,33 @@
<div class="page agent-page">
<header class="session-header">
<button class="back-btn" data-page="dashboard">←</button>
<h1>Agent</h1>
<h1 id="agentPageTitle">Neuer Agent</h1>
</header>
<div class="placeholder-page">
<div class="placeholder-icon">🤖</div>
<h2>Agents</h2>
<p>Hier wird der ausgewählte Agent angezeigt.</p>
<div class="agent-form">
<div class="agent-avatar-section">
<div class="agent-avatar-preview" id="avatarPreview">?</div>
<input type="file" id="avatarInput" accept="image/*" hidden>
<button id="avatarBtn">Avatar ändern</button>
<button id="avatarClearBtn">Entfernen</button>
</div>
<label>Name</label>
<input type="text" id="agentName" placeholder="Name des Agents">
<label>Beschreibung</label>
<input type="text" id="agentDescription" placeholder="Kurze Beschreibung (optional)">
<label>Model</label>
<select id="agentModel">
<option value="sonnet">Sonnet 4.6</option>
<option value="opus">Opus 4.6</option>
</select>
<label>Persona</label>
<textarea id="agentPersona" rows="6" placeholder="Persönlichkeit / Seele des Agents"></textarea>
<label>Instructions</label>
<textarea id="agentInstructions" rows="6" placeholder="Technische Anweisungen"></textarea>
<div class="agent-form-actions">
<button id="agentSaveBtn">Speichern</button>
<button id="agentCancelBtn">Abbrechen</button>
<button id="agentDeleteBtn" class="danger-btn" hidden>Löschen</button>
</div>
</div>
</div>
</template>
@@ -107,6 +125,7 @@
<script src="js/history.js"></script>
<script src="js/router.js"></script>
<script src="js/pages/dashboard.js"></script>
<script src="js/pages/agent-page.js"></script>
<script src="js/pages/session-page.js"></script>
<script src="js/app.js"></script>
</body>