AutoCommit: Bool → Dropdown (mention/enforce/forbid), leerer System-Prompt fix
This commit is contained in:
1 parent
7410a18755
commit
40bab457d9
10 files changed
+52
-27
No files matched your search
@@ -66,11 +66,13 @@ public class AnthropicService
|
||||
["model"] = modelId,
|
||||
["max_tokens"] = 16384,
|
||||
["cache_control"] = new { type = "ephemeral" },
|
||||
["system"] = systemPrompt,
|
||||
["messages"] = messages,
|
||||
["stream"] = true
|
||||
};
|
||||
|
||||
if (systemPrompt != null && systemPrompt.Count > 0)
|
||||
payload["system"] = systemPrompt;
|
||||
|
||||
var hasWorkspace = !string.IsNullOrEmpty(workspace);
|
||||
var includeMemory = useMemory && _memoryService != null && !string.IsNullOrEmpty(agentId);
|
||||
|
||||
|
||||
@@ -130,6 +130,14 @@ public class DatabaseService
|
||||
TryAddColumn(conn, "agents", "custom_commands", "TEXT");
|
||||
TryAddColumn(conn, "messages", "is_marked", "INTEGER NOT NULL DEFAULT 0");
|
||||
TryAddColumn(conn, "agents", "auto_commit", "INTEGER NOT NULL DEFAULT 0");
|
||||
|
||||
// Migration: auto_commit von INTEGER (0/1) zu TEXT ("", "mention", "forbid")
|
||||
try
|
||||
{
|
||||
conn.Execute("UPDATE agents SET auto_commit = '' WHERE auto_commit = '0' OR auto_commit = 0");
|
||||
conn.Execute("UPDATE agents SET auto_commit = 'enforce' WHERE auto_commit = '1' OR auto_commit = 1");
|
||||
}
|
||||
catch { /* already migrated */ }
|
||||
TryAddColumn(conn, "agents", "use_soul", "INTEGER NOT NULL DEFAULT 1");
|
||||
TryAddColumn(conn, "agents", "use_identity", "INTEGER NOT NULL DEFAULT 1");
|
||||
TryAddColumn(conn, "agents", "use_user_info", "INTEGER NOT NULL DEFAULT 1");
|
||||
|
||||
@@ -150,24 +150,35 @@ Wenn der User auf eine bestimmte Zeile in einer Datei verweist (z.B. `[Datei: fo
|
||||
// Git-Commit-Verhalten: relevant sobald Workspace vorhanden (unabhängig von ToolChoice)
|
||||
if (!string.IsNullOrWhiteSpace(session.Workspace))
|
||||
{
|
||||
if (agent.AutoCommit)
|
||||
var autoCommit = (agent.AutoCommit ?? "").ToLowerInvariant();
|
||||
if (autoCommit == "mention")
|
||||
{
|
||||
blocks.Add(new PromptBlock
|
||||
{
|
||||
Icon = "fa-code-branch",
|
||||
Label = "Agent · Git-Verhalten (Workspace + AutoCommit)",
|
||||
Content = "## Git-Commits\n- Nach jeder abgeschlossenen Änderung MUSS ein Git-Commit erstellt werden. Prüfe Änderungen mit `git diff`, erstelle einen passenden Commit mit einer aussagekräftigen Message. Mehrere zusammenhängende Änderungen dürfen in einem Commit zusammengefasst werden."
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
blocks.Add(new PromptBlock
|
||||
{
|
||||
Icon = "fa-code-branch",
|
||||
Label = "Agent · Git-Verhalten (Workspace)",
|
||||
Label = "Agent · Git-Verhalten (Workspace, Anmerken)",
|
||||
Content = "## Git-Commits\n- Git-Commits NIEMALS eigenständig erstellen. Commits werden NUR durchgeführt wenn der User es EXPLIZIT anfordert (z.B. \"erstelle einen Commit\", \"commit\"). Auch nach abgeschlossenen Aufgaben NICHT automatisch committen."
|
||||
});
|
||||
}
|
||||
else if (autoCommit == "enforce")
|
||||
{
|
||||
blocks.Add(new PromptBlock
|
||||
{
|
||||
Icon = "fa-code-branch",
|
||||
Label = "Agent · Git-Verhalten (Workspace, Erzwungen)",
|
||||
Content = "## Git-Commits\n- Nach JEDER abgeschlossenen Änderung MUSS ein Git-Commit erstellt werden. Erstelle aussagekräftige Commit-Messages die beschreiben was geändert wurde."
|
||||
});
|
||||
}
|
||||
else if (autoCommit == "forbid")
|
||||
{
|
||||
blocks.Add(new PromptBlock
|
||||
{
|
||||
Icon = "fa-code-branch",
|
||||
Label = "Agent · Git-Verhalten (Workspace, Verboten)",
|
||||
Content = "## Git-Commits\n- Git-Commits sind STRIKT VERBOTEN. Du darfst unter KEINEN Umständen eigenständig Git-Commits erstellen, auch nicht wenn der User danach fragt. Verweise stattdessen darauf, dass der User den Commit selbst durchführen soll."
|
||||
});
|
||||
}
|
||||
// autoCommit == "" → kein Block, Thema wird nicht erwähnt
|
||||
}
|
||||
|
||||
if (toolAny && !string.IsNullOrWhiteSpace(session.Workspace))
|
||||
|
||||
Reference in new issue
Block a user