mirror of
https://github.com/router-for-me/CLIProxyAPIPlus.git
synced 2026-06-06 17:49:19 +08:00
Merge pull request #2491 from mpfo0106/feature/claude-code-safe-alignment-sentinels
test(claude): add compatibility sentinels and centralize builtin fallback handling
This commit is contained in:
@@ -951,12 +951,9 @@ func applyClaudeToolPrefix(body []byte, prefix string) []byte {
|
||||
return body
|
||||
}
|
||||
|
||||
// Collect built-in tool names (those with a non-empty "type" field) so we can
|
||||
// skip them consistently in both tools and message history.
|
||||
builtinTools := map[string]bool{}
|
||||
for _, name := range []string{"web_search", "code_execution", "text_editor", "computer"} {
|
||||
builtinTools[name] = true
|
||||
}
|
||||
// Collect built-in tool names from the authoritative fallback seed list and
|
||||
// augment it with any typed built-ins present in the current request body.
|
||||
builtinTools := helps.AugmentClaudeBuiltinToolRegistry(body, nil)
|
||||
|
||||
if tools := gjson.GetBytes(body, "tools"); tools.Exists() && tools.IsArray() {
|
||||
tools.ForEach(func(index, tool gjson.Result) bool {
|
||||
|
||||
Reference in New Issue
Block a user