Skip to content

Commit

Permalink
feat: auto ban 403
Browse files Browse the repository at this point in the history
  • Loading branch information
Calcium-Ion committed Jun 16, 2024
1 parent e8845ce commit e3f6680
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion service/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func ShouldDisableChannel(err *relaymodel.OpenAIError, statusCode int) bool {
if err == nil {
return false
}
if statusCode == http.StatusUnauthorized {
if statusCode == http.StatusUnauthorized || statusCode == http.StatusForbidden {
return true
}
switch err.Code {
Expand Down Expand Up @@ -59,6 +59,8 @@ func ShouldDisableChannel(err *relaymodel.OpenAIError, statusCode int) bool {
return true
} else if strings.HasPrefix(err.Message, "You exceeded your current quota") {
return true
} else if strings.HasPrefix(err.Message, "Permission denied") {
return true
}
return false
}
Expand Down

0 comments on commit e3f6680

Please sign in to comment.