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
a0e35256
authored
Feb 22, 2024
by
1808837298@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 记录更多的错误信息
parent
dda0f63d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
controller/relay.go
+4
-3
middleware/distributor.go
+1
-1
No files found.
controller/relay.go
View file @
a0e35256
...
@@ -409,12 +409,13 @@ func RelayMidjourney(c *gin.Context) {
...
@@ -409,12 +409,13 @@ func RelayMidjourney(c *gin.Context) {
if
err
.
Code
==
30
{
if
err
.
Code
==
30
{
err
.
Result
=
"当前分组负载已饱和,请稍后再试,或升级账户以提升服务质量。"
err
.
Result
=
"当前分组负载已饱和,请稍后再试,或升级账户以提升服务质量。"
}
}
c
.
JSON
(
400
,
gin
.
H
{
c
.
JSON
(
429
,
gin
.
H
{
"error"
:
err
.
Description
+
" "
+
err
.
Result
,
"error"
:
fmt
.
Sprintf
(
"%s %s"
,
err
.
Description
,
err
.
Result
),
"type"
:
"upstream_error"
,
})
})
}
}
channelId
:=
c
.
GetInt
(
"channel_id"
)
channelId
:=
c
.
GetInt
(
"channel_id"
)
common
.
SysError
(
fmt
.
Sprintf
(
"relay error (channel #%d): %s"
,
channelId
,
err
.
Result
))
common
.
SysError
(
fmt
.
Sprintf
(
"relay error (channel #%d): %s"
,
channelId
,
fmt
.
Sprintf
(
"%s %s"
,
err
.
Description
,
err
.
Result
)
))
//if shouldDisableChannel(&err.OpenAIError) {
//if shouldDisableChannel(&err.OpenAIError) {
// channelId := c.GetInt("channel_id")
// channelId := c.GetInt("channel_id")
// channelName := c.GetString("channel_name")
// channelName := c.GetString("channel_name")
...
...
middleware/distributor.go
View file @
a0e35256
...
@@ -48,7 +48,7 @@ func Distribute() func(c *gin.Context) {
...
@@ -48,7 +48,7 @@ func Distribute() func(c *gin.Context) {
err
=
common
.
UnmarshalBodyReusable
(
c
,
&
modelRequest
)
err
=
common
.
UnmarshalBodyReusable
(
c
,
&
modelRequest
)
}
}
if
err
!=
nil
{
if
err
!=
nil
{
abortWithMessage
(
c
,
http
.
StatusBadRequest
,
"无效的请求
:
"
+
err
.
Error
())
abortWithMessage
(
c
,
http
.
StatusBadRequest
,
"无效的请求
,
"
+
err
.
Error
())
return
return
}
}
if
strings
.
HasPrefix
(
c
.
Request
.
URL
.
Path
,
"/v1/moderations"
)
{
if
strings
.
HasPrefix
(
c
.
Request
.
URL
.
Path
,
"/v1/moderations"
)
{
...
...
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