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
f158d754
authored
Jun 29, 2023
by
JustSong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: fix the wrong message when channel is deleted
parent
f5d3b896
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
2 deletions
+10
-2
i18n/en.json
+3
-1
middleware/distributor.go
+6
-1
model/ability.go
+1
-0
No files found.
i18n/en.json
View file @
f158d754
...
@@ -456,5 +456,7 @@
...
@@ -456,5 +456,7 @@
"提示"
:
"Prompt"
,
"提示"
:
"Prompt"
,
"补全"
:
"Completion"
,
"补全"
:
"Completion"
,
"消耗额度"
:
"Used Quota"
,
"消耗额度"
:
"Used Quota"
,
"可选值"
:
"Optional Values"
"可选值"
:
"Optional Values"
,
"渠道不存在:%d"
:
"Channel does not exist: %d"
,
"数据库一致性已被破坏,请联系管理员"
:
"Database consistency has been broken, please contact the administrator"
}
}
middleware/distributor.go
View file @
f158d754
...
@@ -75,9 +75,14 @@ func Distribute() func(c *gin.Context) {
...
@@ -75,9 +75,14 @@ func Distribute() func(c *gin.Context) {
}
}
channel
,
err
=
model
.
CacheGetRandomSatisfiedChannel
(
userGroup
,
modelRequest
.
Model
)
channel
,
err
=
model
.
CacheGetRandomSatisfiedChannel
(
userGroup
,
modelRequest
.
Model
)
if
err
!=
nil
{
if
err
!=
nil
{
message
:=
"无可用渠道"
if
channel
!=
nil
{
common
.
SysError
(
fmt
.
Sprintf
(
"渠道不存在:%d"
,
channel
.
Id
))
message
=
"数据库一致性已被破坏,请联系管理员"
}
c
.
JSON
(
http
.
StatusServiceUnavailable
,
gin
.
H
{
c
.
JSON
(
http
.
StatusServiceUnavailable
,
gin
.
H
{
"error"
:
gin
.
H
{
"error"
:
gin
.
H
{
"message"
:
"无可用渠道"
,
"message"
:
message
,
"type"
:
"one_api_error"
,
"type"
:
"one_api_error"
,
},
},
})
})
...
...
model/ability.go
View file @
f158d754
...
@@ -24,6 +24,7 @@ func GetRandomSatisfiedChannel(group string, model string) (*Channel, error) {
...
@@ -24,6 +24,7 @@ func GetRandomSatisfiedChannel(group string, model string) (*Channel, error) {
return
nil
,
err
return
nil
,
err
}
}
channel
:=
Channel
{}
channel
:=
Channel
{}
channel
.
Id
=
ability
.
ChannelId
err
=
DB
.
First
(
&
channel
,
"id = ?"
,
ability
.
ChannelId
)
.
Error
err
=
DB
.
First
(
&
channel
,
"id = ?"
,
ability
.
ChannelId
)
.
Error
return
&
channel
,
err
return
&
channel
,
err
}
}
...
...
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