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

+2 -3
View File
@@ -21,7 +21,6 @@ async function clearChat() {
async function sendMessage() {
const input = $('#input');
const btn = $('#send');
const model = $('#model').value;
const systemPrompt = $('#systemPrompt').value.trim();
const text = input.value.trim();
if (!text) return;
@@ -39,7 +38,7 @@ async function sendMessage() {
let currentToolBox = null;
try {
const resp = await apiChat(model, messages, systemPrompt, getCurrentSessionId());
const resp = await apiChat(messages, systemPrompt, getCurrentSessionId());
const reader = resp.body.getReader();
const decoder = new TextDecoder();
let buffer = '';
@@ -92,7 +91,7 @@ async function sendMessage() {
case 'done':
endStreamBubble();
let meta = `Model: ${data.model || model} | In: ${data.inputTokens || 0} | Out: ${data.outputTokens || 0}`;
let meta = `Model: ${data.model || '?'} | In: ${data.inputTokens || 0} | Out: ${data.outputTokens || 0}`;
if (data.iterations > 1) meta += ` | Iterations: ${data.iterations}`;
if (data.durationMs) meta += ` | ${(data.durationMs / 1000).toFixed(1)}s`;
setMeta(meta);