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:
1 parent
ab234fde69
commit
e79a69a364
9 files changed
+130
-62
No files matched your search
@@ -42,6 +42,10 @@ public static class AgentEndpoint
|
||||
|
||||
var avatarRaw = body.TryGetProperty("avatar", out var av) ? av.GetString() : null;
|
||||
|
||||
string customCommands = null;
|
||||
if (body.TryGetProperty("customCommands", out var ccEl))
|
||||
customCommands = ccEl.ValueKind == JsonValueKind.Null ? null : ccEl.GetRawText();
|
||||
|
||||
var agent = new AgentRecord
|
||||
{
|
||||
Name = body.TryGetProperty("name", out var n) ? n.GetString() ?? "Neuer Agent" : "Neuer Agent",
|
||||
@@ -50,7 +54,8 @@ public static class AgentEndpoint
|
||||
Model = body.TryGetProperty("model", out var m) ? m.GetString() ?? "sonnet" : "sonnet",
|
||||
Persona = body.TryGetProperty("persona", out var p) ? p.GetString() : null,
|
||||
Instructions = body.TryGetProperty("instructions", out var i) ? i.GetString() : null,
|
||||
ToolChoice = body.TryGetProperty("toolChoice", out var tc) ? tc.GetString() ?? "any" : "any"
|
||||
ToolChoice = body.TryGetProperty("toolChoice", out var tc) ? tc.GetString() ?? "any" : "any",
|
||||
CustomCommands = customCommands
|
||||
};
|
||||
|
||||
agent = await db.CreateAgent(agent);
|
||||
@@ -74,6 +79,8 @@ public static class AgentEndpoint
|
||||
if (body.TryGetProperty("persona", out var p)) agent.Persona = p.GetString();
|
||||
if (body.TryGetProperty("instructions", out var i)) agent.Instructions = i.GetString();
|
||||
if (body.TryGetProperty("toolChoice", out var tc)) agent.ToolChoice = tc.GetString();
|
||||
if (body.TryGetProperty("customCommands", out var cc))
|
||||
agent.CustomCommands = cc.ValueKind == JsonValueKind.Null ? null : cc.GetRawText();
|
||||
|
||||
await db.UpdateAgent(agent);
|
||||
agent = await db.GetAgent(agentId);
|
||||
|
||||
Reference in new issue
Block a user