From 62edac7c7fd68c646ee61a5722c336bc093447ed Mon Sep 17 00:00:00 2001 From: CaIon Date: Tue, 18 Nov 2025 16:46:16 +0800 Subject: [PATCH] fix: aws --- relay/channel/aws/dto.go | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/relay/channel/aws/dto.go b/relay/channel/aws/dto.go index 9bebab7b..b060a593 100644 --- a/relay/channel/aws/dto.go +++ b/relay/channel/aws/dto.go @@ -1,12 +1,15 @@ package aws import ( + "context" "encoding/json" "io" "net/http" + "strings" "github.com/QuantumNous/new-api/common" "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/logger" ) type AwsClaudeRequest struct { @@ -34,17 +37,19 @@ func formatRequest(requestBody io.Reader, requestHeader http.Header) (*AwsClaude awsClaudeRequest.AnthropicVersion = "bedrock-2023-05-31" // check header anthropic-beta - anthropicBetaValues := requestHeader.Values("anthropic-beta") + anthropicBetaValues := requestHeader.Get("anthropic-beta") if len(anthropicBetaValues) > 0 { - betaJson, err := json.Marshal(anthropicBetaValues) - if err != nil { - return nil, err - } var tempArray []string - if err := json.Unmarshal(betaJson, &tempArray); err == nil && len(tempArray) != 0 && len(betaJson) > 0 { - awsClaudeRequest.AnthropicBeta = json.RawMessage(betaJson) + tempArray = strings.Split(anthropicBetaValues, ",") + if len(tempArray) > 0 { + betaJson, err := json.Marshal(tempArray) + if err != nil { + return nil, err + } + awsClaudeRequest.AnthropicBeta = betaJson } } + logger.LogJson(context.Background(), "json", awsClaudeRequest) return &awsClaudeRequest, nil }