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
a03cfe9e
authored
May 12, 2024
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 只自动启用被自动禁用的渠道 (close #224)
parent
a7f01cb6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
controller/channel-test.go
+1
-1
service/channel.go
+4
-1
No files found.
controller/channel-test.go
View file @
a03cfe9e
...
...
@@ -208,7 +208,7 @@ func testAllChannels(notify bool) error {
if
isChannelEnabled
&&
service
.
ShouldDisableChannel
(
openaiErr
,
-
1
)
&&
ban
{
service
.
DisableChannel
(
channel
.
Id
,
channel
.
Name
,
err
.
Error
())
}
if
!
isChannelEnabled
&&
service
.
ShouldEnableChannel
(
err
,
openaiErr
)
{
if
!
isChannelEnabled
&&
service
.
ShouldEnableChannel
(
err
,
openaiErr
,
channel
.
Status
)
{
service
.
EnableChannel
(
channel
.
Id
,
channel
.
Name
)
}
channel
.
UpdateResponseTime
(
milliseconds
)
...
...
service/channel.go
View file @
a03cfe9e
...
...
@@ -63,7 +63,7 @@ func ShouldDisableChannel(err *relaymodel.OpenAIError, statusCode int) bool {
return
false
}
func
ShouldEnableChannel
(
err
error
,
openAIErr
*
relaymodel
.
OpenAIError
)
bool
{
func
ShouldEnableChannel
(
err
error
,
openAIErr
*
relaymodel
.
OpenAIError
,
status
int
)
bool
{
if
!
common
.
AutomaticEnableChannelEnabled
{
return
false
}
...
...
@@ -73,5 +73,8 @@ func ShouldEnableChannel(err error, openAIErr *relaymodel.OpenAIError) bool {
if
openAIErr
!=
nil
{
return
false
}
if
status
!=
common
.
ChannelStatusAutoDisabled
{
return
false
}
return
true
}
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