Remove tool_choice agent option - auto-detect based on workspace/skills/memory
- Remove tool_choice from AgentEndpoint (create, update, list responses) - ChatService: automatically set tool_choice='any' when workspace, memory or skills present, null otherwise. Same for preparer/review/finalizer - SystemPromptBuilder: remove 3 toolAny-conditional prompt blocks (KRITISCH, Verhalten, ERINNERUNG) - Frontend: remove checkbox, badge and JS references - Agent.ToolChoice DB field preserved for backward compat, no longer read
This commit is contained in:
1 parent
677b227200
commit
83945689a6
6 files changed
+10
-55
No files matched your search
+10
-6
@@ -68,11 +68,12 @@ public class ChatService
|
||||
agentSkills, _skillService, userPersona: user?.GetEffectivePersona(),
|
||||
resolvedWorkspace: workspace, planMode: planMode);
|
||||
|
||||
var toolChoice = agent.ToolChoice ?? "any";
|
||||
var hasWorkspace = !string.IsNullOrEmpty(workspace);
|
||||
var includeMemory = agent.UseMemory && !string.IsNullOrEmpty(agent.AgentId);
|
||||
var hasTools = hasWorkspace || includeMemory;
|
||||
var toolChoice = hasTools ? "any" : null;
|
||||
|
||||
var toolDefs = (hasWorkspace || includeMemory)
|
||||
var toolDefs = hasTools
|
||||
? _toolService.GetToolDefinitions(includeFileTools: hasWorkspace, includeMemory: includeMemory, includeUserChoice: agent.AllowUserChoice)
|
||||
: Array.Empty<object>();
|
||||
var toolNames = toolDefs.Length > 0
|
||||
@@ -93,7 +94,7 @@ public class ChatService
|
||||
AgentId = agent.AgentId,
|
||||
Model = modelId,
|
||||
SystemPrompt = systemPromptText,
|
||||
ToolChoice = (hasWorkspace || includeMemory) ? toolChoice : null,
|
||||
ToolChoice = toolChoice,
|
||||
ToolNames = toolNames,
|
||||
PlanMode = planMode
|
||||
});
|
||||
@@ -159,6 +160,7 @@ Rückfrage (NUR mit [QUESTION] – stoppt die Weiterleitung):
|
||||
Für welche Plattform soll die App entwickelt werden? Web, Mobile oder Desktop?
|
||||
```" });
|
||||
|
||||
var preparerHasTools = !string.IsNullOrEmpty(preparerWorkspace) || preparerAgent.UseMemory;
|
||||
preparerContext = new PreparerContext
|
||||
{
|
||||
ModelId = preparerModelId,
|
||||
@@ -167,7 +169,7 @@ Für welche Plattform soll die App entwickelt werden? Web, Mobile oder Desktop?
|
||||
Workspace = preparerWorkspace,
|
||||
UseMemory = preparerAgent.UseMemory,
|
||||
WebSearchVersion = preparerAgent.WebSearchVersion,
|
||||
ToolChoice = preparerAgent.ToolChoice ?? "any",
|
||||
ToolChoice = preparerHasTools ? "any" : "auto",
|
||||
AllowUserChoice = preparerAgent.AllowUserChoice,
|
||||
Agent = preparerAgent
|
||||
};
|
||||
@@ -195,6 +197,7 @@ Für welche Plattform soll die App entwickelt werden? Web, Mobile oder Desktop?
|
||||
if (!string.IsNullOrWhiteSpace(reviewSystemText))
|
||||
reviewPrompt.Add(new { type = "text", text = reviewSystemText });
|
||||
|
||||
var reviewHasTools = !string.IsNullOrEmpty(reviewWorkspace) || reviewAgent.UseMemory;
|
||||
reviewContext = new ReviewContext
|
||||
{
|
||||
ModelId = reviewModelId,
|
||||
@@ -203,7 +206,7 @@ Für welche Plattform soll die App entwickelt werden? Web, Mobile oder Desktop?
|
||||
Workspace = reviewWorkspace,
|
||||
UseMemory = reviewAgent.UseMemory,
|
||||
WebSearchVersion = reviewAgent.WebSearchVersion,
|
||||
ToolChoice = reviewAgent.ToolChoice ?? "any",
|
||||
ToolChoice = reviewHasTools ? "any" : "auto",
|
||||
MaxReviewIterations = session.MaxReviewIterations > 0 ? session.MaxReviewIterations : 3,
|
||||
Agent = reviewAgent
|
||||
};
|
||||
@@ -231,6 +234,7 @@ Für welche Plattform soll die App entwickelt werden? Web, Mobile oder Desktop?
|
||||
if (!string.IsNullOrWhiteSpace(finalizerSystemText))
|
||||
finalizerPrompt.Add(new { type = "text", text = finalizerSystemText });
|
||||
|
||||
var finalizerHasTools = !string.IsNullOrEmpty(finalizerWorkspace) || finalizerAgent.UseMemory;
|
||||
finalizerContext = new FinalizerContext
|
||||
{
|
||||
ModelId = finalizerModelId,
|
||||
@@ -239,7 +243,7 @@ Für welche Plattform soll die App entwickelt werden? Web, Mobile oder Desktop?
|
||||
Workspace = finalizerWorkspace,
|
||||
UseMemory = finalizerAgent.UseMemory,
|
||||
WebSearchVersion = finalizerAgent.WebSearchVersion,
|
||||
ToolChoice = finalizerAgent.ToolChoice ?? "any",
|
||||
ToolChoice = finalizerHasTools ? "any" : "auto",
|
||||
Agent = finalizerAgent
|
||||
};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user