Session-Kontext: Textarea für System-Prompt pro Session
This commit is contained in:
1 parent
b752c99a64
commit
48be82905e
7 files changed
+17
-18
No files matched your search
@@ -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<SessionRecord> CreateSession(string name = null, string description = null, string image = null, string agentId = null, string workspace = null)
|
||||
public async Task<SessionRecord> 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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user