diff --git a/relay/controller/error.go b/relay/controller/error.go index 69ece3ec..29d4f125 100644 --- a/relay/controller/error.go +++ b/relay/controller/error.go @@ -53,6 +53,16 @@ func (e GeneralErrorResponse) ToMessage() string { } func RelayErrorHandler(resp *http.Response) (ErrorWithStatusCode *model.ErrorWithStatusCode) { + if resp == nil { + return &model.ErrorWithStatusCode{ + StatusCode: 500, + Error: model.Error{ + Message: "resp is nil", + Type: "upstream_error", + Code: "bad_response", + }, + } + } ErrorWithStatusCode = &model.ErrorWithStatusCode{ StatusCode: resp.StatusCode, Error: model.Error{ diff --git a/relay/controller/helper.go b/relay/controller/helper.go index 2489652c..dccff486 100644 --- a/relay/controller/helper.go +++ b/relay/controller/helper.go @@ -208,6 +208,9 @@ func getMappedModelName(modelName string, mapping map[string]string) (string, bo func isErrorHappened(meta *meta.Meta, resp *http.Response) bool { if resp == nil { + if meta.ChannelType == channeltype.AwsClaude { + return false + } return true } if resp.StatusCode != http.StatusOK {