Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
e5225230
authored
Jun 16, 2024
by
1808837298@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: auto ban 403
parent
69ceb3ca
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletions
+3
-1
service/channel.go
+3
-1
No files found.
service/channel.go
View file @
e5225230
...
@@ -31,7 +31,7 @@ func ShouldDisableChannel(err *relaymodel.OpenAIError, statusCode int) bool {
...
@@ -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 {
...
@@ -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
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment