Fix/claude thinking tool call conversion (#3756)

Signed-off-by: wydream <yaodiwu618@gmail.com>
This commit is contained in:
woody
2026-05-20 11:34:07 +08:00
committed by GitHub
parent f1dfc8f3d2
commit e1e631263c
12 changed files with 1113 additions and 58 deletions

View File

@@ -468,6 +468,27 @@ func TestProviderConfig_GetPromoteThinkingOnEmpty(t *testing.T) {
}
}
func TestProviderConfig_GetLogUpstreamErrorResponseBody(t *testing.T) {
tests := []struct {
name string
logUpstreamErrorResponseBody bool
expected bool
}{
{"enabled", true, true},
{"default_disabled", false, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
config := &ProviderConfig{
logUpstreamErrorResponseBody: tt.logUpstreamErrorResponseBody,
}
result := config.GetLogUpstreamErrorResponseBody()
assert.Equal(t, tt.expected, result)
})
}
}
// ============ Failover Tests ============
func TestFailover_FromJson_Defaults(t *testing.T) {
@@ -763,4 +784,9 @@ func TestStripClaudeInternalMessageFields(t *testing.T) {
assert.False(t, gjson.GetBytes(result, "messages.0.claude_content_block_index").Exists())
assert.False(t, gjson.GetBytes(result, "messages.0.claude_content_block_stop").Exists())
assert.Equal(t, "answer", gjson.GetBytes(result, "messages.0.content").String())
preserved := stripClaudeInternalMessageFields(body, true)
assert.Equal(t, "reasoning", gjson.GetBytes(preserved, "messages.0.reasoning_content").String())
assert.False(t, gjson.GetBytes(preserved, "messages.0.reasoning_signature").Exists())
assert.False(t, gjson.GetBytes(preserved, "messages.0.claude_content_blocks").Exists())
}