Skip to content

Commit 2bfbc84

Browse files
authored
fix: ali object is not iterable error need mapping to 400 error (#383)
1 parent d2e17a0 commit 2bfbc84

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

core/relay/adaptor/ali/error.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package ali
22

33
import (
44
"net/http"
5+
"strings"
56

67
"github.com/labring/aiproxy/core/relay/adaptor"
78
"github.com/labring/aiproxy/core/relay/adaptor/openai"
@@ -23,5 +24,9 @@ func ErrorHanlder(resp *http.Response) adaptor.Error {
2324
openAIError.Type = relaymodel.ErrorTypeUpstream
2425
}
2526

27+
if strings.Contains(openAIError.Message, "object is not iterable") {
28+
statusCode = http.StatusBadRequest
29+
}
30+
2631
return relaymodel.NewOpenAIError(statusCode, openAIError)
2732
}

0 commit comments

Comments
 (0)