fix(gateway): 移除 PR #316 引入的工具名转换逻辑
移除响应阶段的工具名/schema/description 转换逻辑,修复第三方工具调用时 工具名被错误转换的问题(如 Task → task)。 移除内容: - 工具名相关正则变量(toolPrefixRe, toolNameBoundaryRe 等) - openCodeToolOverrides 和 claudeToolNameOverrides 映射表 - 工具名转换函数(normalizeToolNameForClaude, normalizeToolNameForOpenCode 等) - 响应体工具名替换函数(replaceToolNamesInText, replaceToolNamesInResponseBody 等) - 参数名转换函数(normalizeParamNameForOpenCode, rewriteParamKeysInValue) - 工具描述清理函数(sanitizeToolDescription) - 输入 schema 转换函数(normalizeToolInputSchema) - 模型 ID 正则替换函数(replaceModelIDInText) 保留内容: - 系统提示词清理(sanitizeSystemText) - Claude Code 指纹 headers 处理 - 模型 ID 映射(通过 JSON 对象操作)
This commit is contained in:
@@ -12,10 +12,3 @@ func TestSanitizeOpenCodeText_RewritesCanonicalSentence(t *testing.T) {
|
||||
got := sanitizeSystemText(in)
|
||||
require.Equal(t, strings.TrimSpace(claudeCodeSystemPrompt), got)
|
||||
}
|
||||
|
||||
func TestSanitizeToolDescription_DoesNotRewriteKeywords(t *testing.T) {
|
||||
in := "OpenCode and opencode are mentioned."
|
||||
got := sanitizeToolDescription(in)
|
||||
// We no longer rewrite tool descriptions; only redact obvious path leaks.
|
||||
require.Equal(t, in, got)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user