mirror of
https://github.com/linux-do/new-api.git
synced 2025-11-13 01:23:41 +08:00
Merge remote-tracking branch 'upstream/main'
This commit is contained in:
@@ -24,7 +24,7 @@ func EnableChannel(channelId int, channelName string) {
|
||||
notifyRootUser(subject, content)
|
||||
}
|
||||
|
||||
func ShouldDisableChannel(err *relaymodel.OpenAIErrorWithStatusCode) bool {
|
||||
func ShouldDisableChannel(channelType int, err *relaymodel.OpenAIErrorWithStatusCode) bool {
|
||||
if !common.AutomaticDisableChannelEnabled {
|
||||
return false
|
||||
}
|
||||
@@ -34,9 +34,15 @@ func ShouldDisableChannel(err *relaymodel.OpenAIErrorWithStatusCode) bool {
|
||||
if err.LocalError {
|
||||
return false
|
||||
}
|
||||
if err.StatusCode == http.StatusUnauthorized || err.StatusCode == http.StatusForbidden {
|
||||
if err.StatusCode == http.StatusUnauthorized {
|
||||
return true
|
||||
}
|
||||
if err.StatusCode == http.StatusForbidden {
|
||||
switch channelType {
|
||||
case common.ChannelTypeGemini:
|
||||
return true
|
||||
}
|
||||
}
|
||||
switch err.Error.Code {
|
||||
case "invalid_api_key":
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user