mirror of
https://github.com/alibaba/higress.git
synced 2026-05-26 13:47:27 +08:00
Fix/claude thinking tool call conversion (#3756)
Signed-off-by: wydream <yaodiwu618@gmail.com>
This commit is contained in:
@@ -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())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user