Merge remote-tracking branch 'origin/upstream/main'

This commit is contained in:
Laisky.Cai
2024-05-04 00:54:10 +00:00
11 changed files with 49 additions and 3 deletions

View File

@@ -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{

View File

@@ -210,6 +210,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 {