diff --git a/Endpoints/AgentEndpoint.cs b/Endpoints/AgentEndpoint.cs index 1bd1f06..aa8d17a 100644 --- a/Endpoints/AgentEndpoint.cs +++ b/Endpoints/AgentEndpoint.cs @@ -66,6 +66,7 @@ public static class AgentEndpoint UseWebSearch = body.TryGetProperty("webSearchVersion", out var wsv) && !string.IsNullOrEmpty(wsv.GetString()), WebSearchVersion = body.TryGetProperty("webSearchVersion", out var wsv2) ? wsv2.GetString() ?? "" : "", AllowUserChoice = !body.TryGetProperty("allowUserChoice", out var auc) || auc.GetBoolean(), + TaskInstruction = body.TryGetProperty("taskInstruction", out var ti) ? ti.GetString() : null, AvatarScale = body.TryGetProperty("avatarScale", out var asc) ? asc.GetDouble() : 1.0, AvatarOffsetX = body.TryGetProperty("avatarOffsetX", out var aox) ? aox.GetDouble() : 0, AvatarOffsetY = body.TryGetProperty("avatarOffsetY", out var aoy) ? aoy.GetDouble() : 0 @@ -105,6 +106,7 @@ public static class AgentEndpoint agent.UseWebSearch = !string.IsNullOrEmpty(agent.WebSearchVersion); } if (body.TryGetProperty("allowUserChoice", out var auc)) agent.AllowUserChoice = auc.GetBoolean(); + if (body.TryGetProperty("taskInstruction", out var ti)) agent.TaskInstruction = ti.GetString(); if (body.TryGetProperty("avatarScale", out var asc)) agent.AvatarScale = asc.GetDouble(); if (body.TryGetProperty("avatarOffsetX", out var aox)) agent.AvatarOffsetX = aox.GetDouble(); if (body.TryGetProperty("avatarOffsetY", out var aoy)) agent.AvatarOffsetY = aoy.GetDouble(); diff --git a/Models/AgentRecord.cs b/Models/AgentRecord.cs index cea8231..aca24c8 100644 --- a/Models/AgentRecord.cs +++ b/Models/AgentRecord.cs @@ -18,6 +18,7 @@ public class AgentRecord public bool UseWebSearch { get; set; } public string WebSearchVersion { get; set; } = ""; public bool AllowUserChoice { get; set; } = true; + public string TaskInstruction { get; set; } public double AvatarScale { get; set; } = 1.0; public double AvatarOffsetX { get; set; } public double AvatarOffsetY { get; set; } diff --git a/Services/DatabaseService.cs b/Services/DatabaseService.cs index 199b9a7..e08e291 100644 --- a/Services/DatabaseService.cs +++ b/Services/DatabaseService.cs @@ -179,6 +179,7 @@ public class DatabaseService TryAddColumn(conn, "agents", "avatar_offset_y", "REAL NOT NULL DEFAULT 0"); TryAddColumn(conn, "sessions", "finalizer_agent_id", "TEXT"); TryAddColumn(conn, "agents", "allow_user_choice", "INTEGER NOT NULL DEFAULT 1"); + TryAddColumn(conn, "agents", "task_instruction", "TEXT"); TryAddColumn(conn, "chains", "plan_mode", "INTEGER NOT NULL DEFAULT 0"); TryAddColumn(conn, "sessions", "preparer_agent_id", "TEXT"); TryAddColumn(conn, "messages", "tag", "TEXT"); @@ -334,8 +335,8 @@ public class DatabaseService agent.CreatedAt = now; agent.UpdatedAt = now; await conn.ExecuteAsync(@" - INSERT INTO agents (agent_id, user_id, name, avatar, description, model, tool_choice, custom_commands, auto_commit, use_soul, use_identity, use_user_info, use_memory, use_web_search, web_search_version, allow_user_choice, avatar_scale, avatar_offset_x, avatar_offset_y, is_deleted, created_at, updated_at) - VALUES (@AgentId, @UserId, @Name, @Avatar, @Description, @Model, @ToolChoice, @CustomCommands, @AutoCommit, @UseSoul, @UseIdentity, @UseUserInfo, @UseMemory, @UseWebSearch, @WebSearchVersion, @AllowUserChoice, @AvatarScale, @AvatarOffsetX, @AvatarOffsetY, 0, @CreatedAt, @UpdatedAt) + INSERT INTO agents (agent_id, user_id, name, avatar, description, model, tool_choice, custom_commands, auto_commit, use_soul, use_identity, use_user_info, use_memory, use_web_search, web_search_version, allow_user_choice, task_instruction, avatar_scale, avatar_offset_x, avatar_offset_y, is_deleted, created_at, updated_at) + VALUES (@AgentId, @UserId, @Name, @Avatar, @Description, @Model, @ToolChoice, @CustomCommands, @AutoCommit, @UseSoul, @UseIdentity, @UseUserInfo, @UseMemory, @UseWebSearch, @WebSearchVersion, @AllowUserChoice, @TaskInstruction, @AvatarScale, @AvatarOffsetX, @AvatarOffsetY, 0, @CreatedAt, @UpdatedAt) ", agent); return agent; } @@ -363,7 +364,7 @@ public class DatabaseService model = @Model, tool_choice = @ToolChoice, custom_commands = @CustomCommands, auto_commit = @AutoCommit, use_soul = @UseSoul, use_identity = @UseIdentity, use_user_info = @UseUserInfo, use_memory = @UseMemory, use_web_search = @UseWebSearch, web_search_version = @WebSearchVersion, - allow_user_choice = @AllowUserChoice, + allow_user_choice = @AllowUserChoice, task_instruction = @TaskInstruction, avatar_scale = @AvatarScale, avatar_offset_x = @AvatarOffsetX, avatar_offset_y = @AvatarOffsetY, updated_at = @UpdatedAt WHERE agent_id = @AgentId AND user_id = @UserId ", agent); diff --git a/Services/SystemPromptBuilder.cs b/Services/SystemPromptBuilder.cs index a0bdd24..1f8550d 100644 --- a/Services/SystemPromptBuilder.cs +++ b/Services/SystemPromptBuilder.cs @@ -39,6 +39,12 @@ public static class SystemPromptBuilder blocks.Add(new PromptBlock { Icon = "fa-heart", Label = "Agent · SOUL.md (UseSoul)", Content = soul }); } + // Anweisungen + if (!string.IsNullOrWhiteSpace(agent.TaskInstruction)) + { + blocks.Add(new PromptBlock { Icon = "fa-clipboard", Label = "Agent · Anweisungen", Content = $"## Anweisungen\n{agent.TaskInstruction.Trim()}" }); + } + // User-Info: Persona aus dem Profil des Users der gerade schreibt if (agent.UseUserInfo && !string.IsNullOrWhiteSpace(userPersona)) { diff --git a/wwwroot/index.html b/wwwroot/index.html index 35efff3..37d1993 100644 --- a/wwwroot/index.html +++ b/wwwroot/index.html @@ -199,9 +199,11 @@ Tool-Nutzung erzwingen (tool_choice: any) + +