diff --git a/Endpoints/ChatEndpoint.cs b/Endpoints/ChatEndpoint.cs index 001a7dc..28861c5 100644 --- a/Endpoints/ChatEndpoint.cs +++ b/Endpoints/ChatEndpoint.cs @@ -83,6 +83,9 @@ public static class ChatEndpoint if (!string.IsNullOrWhiteSpace(agent.Instructions)) promptParts.Add($"## Instructions\n{agent.Instructions}"); + if (!string.IsNullOrWhiteSpace(session.Context)) + promptParts.Add($"## Kontext\n{session.Context}"); + var systemPromptText = string.Join("\n\n", promptParts); var chainId = Guid.NewGuid().ToString("N"); diff --git a/Endpoints/SessionEndpoint.cs b/Endpoints/SessionEndpoint.cs index 4a165ed..6c92749 100644 --- a/Endpoints/SessionEndpoint.cs +++ b/Endpoints/SessionEndpoint.cs @@ -51,8 +51,9 @@ public static class SessionEndpoint var image = body.TryGetProperty("image", out var img) ? img.GetString() : null; var agentId = body.TryGetProperty("agentId", out var a) ? a.GetString() : null; var workspace = body.TryGetProperty("workspace", out var w) ? w.GetString() : null; + var context = body.TryGetProperty("context", out var ctxEl) ? ctxEl.GetString() : null; - var session = await db.CreateSession(name, description, image, agentId, workspace); + var session = await db.CreateSession(name, description, image, agentId, workspace, context); await ctx.Response.WriteAsJsonAsync(session); } diff --git a/Models/SessionRecord.cs b/Models/SessionRecord.cs index bf12ba2..1f19119 100644 --- a/Models/SessionRecord.cs +++ b/Models/SessionRecord.cs @@ -9,6 +9,7 @@ public class SessionRecord public string Image { get; set; } public string AgentId { get; set; } public string Workspace { get; set; } + public string Context { get; set; } public bool IsDeleted { get; set; } public string CreatedAt { get; set; } public string UpdatedAt { get; set; } diff --git a/Services/DatabaseService.cs b/Services/DatabaseService.cs index 83be9c6..70422fd 100644 --- a/Services/DatabaseService.cs +++ b/Services/DatabaseService.cs @@ -102,6 +102,7 @@ public class DatabaseService TryAddColumn(conn, "sessions", "description", "TEXT"); TryAddColumn(conn, "sessions", "image", "TEXT"); TryAddColumn(conn, "sessions", "workspace", "TEXT"); + TryAddColumn(conn, "sessions", "context", "TEXT"); TryAddColumn(conn, "sessions", "is_deleted", "INTEGER NOT NULL DEFAULT 0"); TryAddColumn(conn, "chains", "agent_id", "TEXT"); } @@ -163,7 +164,7 @@ public class DatabaseService // ── Sessions ── - public async Task CreateSession(string name = null, string description = null, string image = null, string agentId = null, string workspace = null) + public async Task CreateSession(string name = null, string description = null, string image = null, string agentId = null, string workspace = null, string context = null) { using var conn = CreateConnection(); var now = DateTime.UtcNow.ToString("o"); @@ -175,12 +176,13 @@ public class DatabaseService Image = image, AgentId = agentId, Workspace = workspace, + Context = context, CreatedAt = now, UpdatedAt = now }; await conn.ExecuteAsync(@" - INSERT INTO sessions (session_id, name, description, image, agent_id, workspace, created_at, updated_at) - VALUES (@SessionId, @Name, @Description, @Image, @AgentId, @Workspace, @CreatedAt, @UpdatedAt) + INSERT INTO sessions (session_id, name, description, image, agent_id, workspace, context, created_at, updated_at) + VALUES (@SessionId, @Name, @Description, @Image, @AgentId, @Workspace, @Context, @CreatedAt, @UpdatedAt) ", session); return session; } @@ -220,6 +222,7 @@ public class DatabaseService if (body.TryGetProperty("image", out var img)) { sets.Add("image = @image"); p.Add("image", img.GetString()); } if (body.TryGetProperty("agentId", out var a)) { sets.Add("agent_id = @agentId2"); p.Add("agentId2", a.GetString()); } if (body.TryGetProperty("workspace", out var w)) { sets.Add("workspace = @workspace"); p.Add("workspace", w.GetString()); } + if (body.TryGetProperty("context", out var ctx)) { sets.Add("context = @context"); p.Add("context", ctx.GetString()); } await conn.ExecuteAsync($"UPDATE sessions SET {string.Join(", ", sets)} WHERE session_id = @sessionId", p); } diff --git a/git-status.sh b/git-status.sh deleted file mode 100755 index 378dec2..0000000 --- a/git-status.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -hostname -echo "" - -GIT="git -c safe.directory=*" - -echo "Uncommited Files:" -$GIT status --porcelain -echo "" - -echo -n "Outgoing Changes: " -$GIT rev-list --count origin/$($GIT rev-parse --abbrev-ref HEAD)..HEAD -echo "" diff --git a/wwwroot/index.html b/wwwroot/index.html index 4e1f807..8aab245 100644 --- a/wwwroot/index.html +++ b/wwwroot/index.html @@ -66,6 +66,8 @@ + +
diff --git a/wwwroot/js/pages/session-page.js b/wwwroot/js/pages/session-page.js index ca63746..7547d40 100644 --- a/wwwroot/js/pages/session-page.js +++ b/wwwroot/js/pages/session-page.js @@ -16,6 +16,7 @@ registerPage('session', { const titleEl = document.getElementById('sessionPageTitle'); const nameEl = document.getElementById('sessionName'); const descEl = document.getElementById('sessionDescription'); + const contextEl = document.getElementById('sessionContext'); const workspaceEl = document.getElementById('sessionWorkspace'); const agentSelect = document.getElementById('agentSelect'); const imagePreview = document.getElementById('sessionImagePreview'); @@ -33,6 +34,7 @@ registerPage('session', { titleEl.textContent = session.name || 'Unbenannt'; nameEl.value = session.name || ''; descEl.value = session.description || ''; + contextEl.value = session.context || ''; workspaceEl.value = session.workspace || ''; _sessionImageData = session.image || null; deleteBtn.hidden = false; @@ -84,6 +86,7 @@ registerPage('session', { description: descEl.value.trim(), image: _sessionImageData, agentId: agentSelect.value || null, + context: contextEl.value || null, workspace: workspaceEl.value.trim() || null };