mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-20 17:26:38 +08:00
feat: auto ban 403
This commit is contained in:
parent
e8845ce1de
commit
e3f66807ee
@ -31,7 +31,7 @@ func ShouldDisableChannel(err *relaymodel.OpenAIError, statusCode int) bool {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if statusCode == http.StatusUnauthorized {
|
if statusCode == http.StatusUnauthorized || statusCode == http.StatusForbidden {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
switch err.Code {
|
switch err.Code {
|
||||||
@ -59,6 +59,8 @@ func ShouldDisableChannel(err *relaymodel.OpenAIError, statusCode int) bool {
|
|||||||
return true
|
return true
|
||||||
} else if strings.HasPrefix(err.Message, "You exceeded your current quota") {
|
} else if strings.HasPrefix(err.Message, "You exceeded your current quota") {
|
||||||
return true
|
return true
|
||||||
|
} else if strings.HasPrefix(err.Message, "Permission denied") {
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user