Custom Commands für Agents: gleiche Befehls-UI wie Sessions, im Chat werden Agent- und Session-Commands zusammengeführt

Backend:
- AgentRecord um CustomCommands-Feld erweitert
- DB-Migration: custom_commands Spalte für agents Tabelle
- Agent-CRUD (Create/Update) verarbeitet customCommands

Frontend:
- commands-ui.js: Shared Utility (createCommandRow, getCommandsFromUI, loadCommandsIntoUI) für Agent- und Session-Page
- Agent-Page: Benutzerdefinierte Befehle Sektion mit Typ-Dropdown
- Chat-Page: Lädt Agent-Commands + Session-Commands, zeigt beide mit Labels wenn beide vorhanden
- Session-Page: Refactored auf shared commands-ui.js Funktionen
- CSS: cmd-bar-label Styling für Agent:/Session: Trennung in der Command-Bar
This commit is contained in:
Meleki committed 2026-02-28 21:35:34 +01:00
1 parent ab234fde69
commit e79a69a364
9 files changed
+130 -62

No files matched your search

+5 -3
View File
@@ -127,6 +127,7 @@ public class DatabaseService
TryAddColumn(conn, "messages", "attachment_count", "INTEGER NOT NULL DEFAULT 0");
TryAddColumn(conn, "messages", "attachment_names", "TEXT");
TryAddColumn(conn, "agents", "tool_choice", "TEXT DEFAULT 'any'");
TryAddColumn(conn, "agents", "custom_commands", "TEXT");
}
private void TryAddColumn(SqliteConnection conn, string table, string column, string type)
@@ -145,8 +146,8 @@ public class DatabaseService
agent.CreatedAt = now;
agent.UpdatedAt = now;
await conn.ExecuteAsync(@"
INSERT INTO agents (agent_id, name, avatar, description, model, persona, instructions, tool_choice, is_deleted, created_at, updated_at)
VALUES (@AgentId, @Name, @Avatar, @Description, @Model, @Persona, @Instructions, @ToolChoice, 0, @CreatedAt, @UpdatedAt)
INSERT INTO agents (agent_id, name, avatar, description, model, persona, instructions, tool_choice, custom_commands, is_deleted, created_at, updated_at)
VALUES (@AgentId, @Name, @Avatar, @Description, @Model, @Persona, @Instructions, @ToolChoice, @CustomCommands, 0, @CreatedAt, @UpdatedAt)
", agent);
return agent;
}
@@ -171,7 +172,8 @@ public class DatabaseService
agent.UpdatedAt = DateTime.UtcNow.ToString("o");
await conn.ExecuteAsync(@"
UPDATE agents SET name = @Name, avatar = @Avatar, description = @Description,
model = @Model, persona = @Persona, instructions = @Instructions, tool_choice = @ToolChoice, updated_at = @UpdatedAt
model = @Model, persona = @Persona, instructions = @Instructions, tool_choice = @ToolChoice,
custom_commands = @CustomCommands, updated_at = @UpdatedAt
WHERE agent_id = @AgentId
", agent);
}