Agent: Max Output Tokens + Thinking deaktivieren einstellbar
Zwei neue Agent-Einstellungen (Frontend, DB-Migration additiv): - MaxOutputTokens: hartes Ausgabelimit. CLI: CLAUDE_CODE_MAX_OUTPUT_TOKENS, API: max_tokens (statt hart 16384). 0 = aus. - DisableThinking: CLI: CLAUDE_CODE_DISABLE_THINKING=1 + MAX_THINKING_TOKENS=0; entfernt CLAUDE_CODE_EFFORT_LEVEL (Explizit-Aus schlaegt Effort). API-Pfad ohne Aequivalent (Hint im UI). Die einzigen zwei Parameter, die z.ai/GLM nachweislich honoriert (Sampling-Parameter wie temperature/top_p werden dort still verworfen). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7305a5a50f
commit
81892d6e65
13 files changed
+88
-9
No files matched your search
@@ -72,6 +72,8 @@ public static class AgentEndpoint
|
||||
a.AllowUserChoice,
|
||||
a.TaskInstruction,
|
||||
a.Effort,
|
||||
a.MaxOutputTokens,
|
||||
a.DisableThinking,
|
||||
a.AvatarScale,
|
||||
a.AvatarOffsetX,
|
||||
a.AvatarOffsetY,
|
||||
@@ -87,6 +89,18 @@ public static class AgentEndpoint
|
||||
return results;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Max-Output-Tokens robust parsen: Zahl, Zahl-als-String oder leer/null (= 0 = aus).
|
||||
/// Negative Werte werden auf 0 geklemmt; das Frontend schickt bei leerem Feld null.
|
||||
/// </summary>
|
||||
private static int ParseMaxOutputTokens(JsonElement el)
|
||||
{
|
||||
int val = 0;
|
||||
if (el.ValueKind == JsonValueKind.Number) el.TryGetInt32(out val);
|
||||
else if (el.ValueKind == JsonValueKind.String) int.TryParse(el.GetString(), out val);
|
||||
return val > 0 ? val : 0;
|
||||
}
|
||||
|
||||
private static async Task HandleGet(HttpContext ctx, DatabaseService db)
|
||||
{
|
||||
var agentId = ctx.Request.RouteValues["agentId"]?.ToString();
|
||||
@@ -139,6 +153,8 @@ public static class AgentEndpoint
|
||||
AllowUserChoice = !body.TryGetProperty("allowUserChoice", out var auc) || auc.GetBoolean(),
|
||||
TaskInstruction = body.TryGetProperty("taskInstruction", out var ti) ? ti.GetString() : null,
|
||||
Effort = body.TryGetProperty("effort", out var ef) ? ef.GetString() ?? "" : "",
|
||||
MaxOutputTokens = body.TryGetProperty("maxOutputTokens", out var mot) ? ParseMaxOutputTokens(mot) : 0,
|
||||
DisableThinking = body.TryGetProperty("disableThinking", out var dt) && dt.ValueKind == JsonValueKind.True,
|
||||
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,
|
||||
@@ -187,6 +203,8 @@ public static class AgentEndpoint
|
||||
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("effort", out var ef)) agent.Effort = ef.GetString() ?? "";
|
||||
if (body.TryGetProperty("maxOutputTokens", out var mot)) agent.MaxOutputTokens = ParseMaxOutputTokens(mot);
|
||||
if (body.TryGetProperty("disableThinking", out var dt)) agent.DisableThinking = dt.ValueKind == JsonValueKind.True;
|
||||
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();
|
||||
|
||||
Reference in new issue
Block a user