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
7e46e678
authored
Apr 24, 2024
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: audio预扣费未返还
parent
9f23e16a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletions
+18
-1
relay/relay-audio.go
+17
-0
relay/relay-image.go
+1
-1
No files found.
relay/relay-audio.go
View file @
7e46e678
...
...
@@ -100,6 +100,22 @@ func AudioHelper(c *gin.Context, relayMode int) *dto.OpenAIErrorWithStatusCode {
}
}
succeed
:=
false
defer
func
()
{
if
succeed
{
return
}
if
preConsumedQuota
>
0
{
// we need to roll back the pre-consumed quota
defer
func
()
{
go
func
()
{
// negative means add quota back for token & user
returnPreConsumedQuota
(
c
,
tokenId
,
userQuota
,
preConsumedQuota
)
}()
}()
}
}()
// map model name
modelMapping
:=
c
.
GetString
(
"model_mapping"
)
if
modelMapping
!=
""
{
...
...
@@ -163,6 +179,7 @@ func AudioHelper(c *gin.Context, relayMode int) *dto.OpenAIErrorWithStatusCode {
if
resp
.
StatusCode
!=
http
.
StatusOK
{
return
relaycommon
.
RelayErrorHandler
(
resp
)
}
succeed
=
true
var
audioResponse
dto
.
AudioResponse
...
...
relay/relay-image.go
View file @
7e46e678
...
...
@@ -34,7 +34,7 @@ func RelayImageHelper(c *gin.Context, relayMode int) *dto.OpenAIErrorWithStatusC
}
if
imageRequest
.
Model
==
""
{
imageRequest
.
Model
=
"dall-e-
2
"
imageRequest
.
Model
=
"dall-e-
3
"
}
if
imageRequest
.
Size
==
""
{
imageRequest
.
Size
=
"1024x1024"
...
...
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