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
451076fa
authored
Sep 10, 2025
by
Xyfacai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: dalle log 显示张数 N
parent
271830fc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
8 deletions
+7
-8
controller/relay.go
+6
-7
relay/image_handler.go
+1
-1
No files found.
controller/relay.go
View file @
451076fa
...
@@ -277,14 +277,13 @@ func shouldRetry(c *gin.Context, openaiErr *types.NewAPIError, retryTimes int) b
...
@@ -277,14 +277,13 @@ func shouldRetry(c *gin.Context, openaiErr *types.NewAPIError, retryTimes int) b
func
processChannelError
(
c
*
gin
.
Context
,
channelError
types
.
ChannelError
,
err
*
types
.
NewAPIError
)
{
func
processChannelError
(
c
*
gin
.
Context
,
channelError
types
.
ChannelError
,
err
*
types
.
NewAPIError
)
{
logger
.
LogError
(
c
,
fmt
.
Sprintf
(
"relay error (channel #%d, status code: %d): %s"
,
channelError
.
ChannelId
,
err
.
StatusCode
,
err
.
Error
()))
logger
.
LogError
(
c
,
fmt
.
Sprintf
(
"relay error (channel #%d, status code: %d): %s"
,
channelError
.
ChannelId
,
err
.
StatusCode
,
err
.
Error
()))
// 不要使用context获取渠道信息,异步处理时可能会出现渠道信息不一致的情况
gopool
.
Go
(
func
()
{
// do not use context to get channel info, there may be inconsistent channel info when processing asynchronously
// 不要使用context获取渠道信息,异步处理时可能会出现渠道信息不一致的情况
if
service
.
ShouldDisableChannel
(
channelError
.
ChannelId
,
err
)
&&
channelError
.
AutoBan
{
// do not use context to get channel info, there may be inconsistent channel info when processing asynchronously
gopool
.
Go
(
func
()
{
if
service
.
ShouldDisableChannel
(
channelError
.
ChannelId
,
err
)
&&
channelError
.
AutoBan
{
service
.
DisableChannel
(
channelError
,
err
.
Error
())
service
.
DisableChannel
(
channelError
,
err
.
Error
())
}
}
)
}
)
}
if
constant
.
ErrorLogEnabled
&&
types
.
IsRecordErrorLog
(
err
)
{
if
constant
.
ErrorLogEnabled
&&
types
.
IsRecordErrorLog
(
err
)
{
// 保存错误日志到mysql中
// 保存错误日志到mysql中
...
...
relay/image_handler.go
View file @
451076fa
...
@@ -120,7 +120,7 @@ func ImageHelper(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *type
...
@@ -120,7 +120,7 @@ func ImageHelper(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *type
var
logContent
string
var
logContent
string
if
len
(
request
.
Size
)
>
0
{
if
len
(
request
.
Size
)
>
0
{
logContent
=
fmt
.
Sprintf
(
"大小 %s, 品质 %s
"
,
request
.
Size
,
quality
)
logContent
=
fmt
.
Sprintf
(
"大小 %s, 品质 %s
, 张数 %d"
,
request
.
Size
,
quality
,
request
.
N
)
}
}
postConsumeQuota
(
c
,
info
,
usage
.
(
*
dto
.
Usage
),
logContent
)
postConsumeQuota
(
c
,
info
,
usage
.
(
*
dto
.
Usage
),
logContent
)
...
...
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