From 2cc459e24fb58b6a8875d952deeb984a5136ec37 Mon Sep 17 00:00:00 2001 From: haruka <1628615876@qq.com> Date: Tue, 29 Sep 2026 05:20:04 +0800 Subject: [PATCH] style: satisfy Sonnet 5.5 lint checks --- .../service/gateway_anthropic_apikey_passthrough_test.go | 5 +++-- backend/internal/service/gateway_request.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/internal/service/gateway_anthropic_apikey_passthrough_test.go b/backend/internal/service/gateway_anthropic_apikey_passthrough_test.go index 8f5d6e82ee..8b7c2d4a09 100644 --- a/backend/internal/service/gateway_anthropic_apikey_passthrough_test.go +++ b/backend/internal/service/gateway_anthropic_apikey_passthrough_test.go @@ -1830,10 +1830,11 @@ func TestSonnet55RejectsUnsupportedParametersBeforeMimicry(t *testing.T) { for _, count := range []bool{false, true} { model := "claude-sonnet-5-5" account := &Account{ID: 1, Platform: PlatformAnthropic, Type: typ} - if typ == AccountTypeAPIKey { + switch typ { + case AccountTypeAPIKey: model = "public-sonnet" account.Credentials = map[string]any{"model_mapping": map[string]any{model: "claude-sonnet-5-5"}} - } else if typ == AccountTypeBedrock { + case AccountTypeBedrock: account.Credentials = map[string]any{"aws_region": "eu-west-1"} } body := []byte(`{"model":"` + model + `","messages":[{"role":"user","content":"hello"}],` + field + `}`) diff --git a/backend/internal/service/gateway_request.go b/backend/internal/service/gateway_request.go index 1ec4db19da..678d7d3d3b 100644 --- a/backend/internal/service/gateway_request.go +++ b/backend/internal/service/gateway_request.go @@ -736,7 +736,7 @@ func FilterThinkingBlocksForRetry(body []byte, mappedModel string) []byte { // Disable top-level thinking mode for retry to avoid structural/signature constraints upstream. thinkingMode := gjson.Get(jsonStr, "thinking.type").String() deleteTopLevelThinking := gjson.Get(jsonStr, "thinking").Exists() && - !(claude.IsSonnet55(mappedModel) && thinkingMode == "between_tools") + (!claude.IsSonnet55(mappedModel) || thinkingMode != "between_tools") for i := 0; i < len(messages); i++ { msgMap, ok := messages[i].(map[string]any)