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
412b935a
authored
Oct 18, 2025
by
feitianbubu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: AudioRequest add metadata support custom params
parent
6de10991
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
7 deletions
+17
-7
dto/audio.go
+10
-7
relay/channel/volcengine/adaptor.go
+7
-0
No files found.
dto/audio.go
View file @
412b935a
package
dto
package
dto
import
(
import
(
"encoding/json"
"github.com/QuantumNous/new-api/types"
"github.com/QuantumNous/new-api/types"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin"
)
)
type
AudioRequest
struct
{
type
AudioRequest
struct
{
Model
string
`json:"model"`
Model
string
`json:"model"`
Input
string
`json:"input"`
Input
string
`json:"input"`
Voice
string
`json:"voice"`
Voice
string
`json:"voice"`
Instructions
string
`json:"instructions,omitempty"`
Instructions
string
`json:"instructions,omitempty"`
ResponseFormat
string
`json:"response_format,omitempty"`
ResponseFormat
string
`json:"response_format,omitempty"`
Speed
float64
`json:"speed,omitempty"`
Speed
float64
`json:"speed,omitempty"`
StreamFormat
string
`json:"stream_format,omitempty"`
StreamFormat
string
`json:"stream_format,omitempty"`
Metadata
json
.
RawMessage
`json:"metadata,omitempty"`
}
}
func
(
r
*
AudioRequest
)
GetTokenCountMeta
()
*
types
.
TokenCountMeta
{
func
(
r
*
AudioRequest
)
GetTokenCountMeta
()
*
types
.
TokenCountMeta
{
...
...
relay/channel/volcengine/adaptor.go
View file @
412b935a
...
@@ -75,6 +75,13 @@ func (a *Adaptor) ConvertAudioRequest(c *gin.Context, info *relaycommon.RelayInf
...
@@ -75,6 +75,13 @@ func (a *Adaptor) ConvertAudioRequest(c *gin.Context, info *relaycommon.RelayInf
},
},
}
}
// 同步扩展字段的厂商自定义metadata
if
len
(
request
.
Metadata
)
>
0
{
if
err
=
json
.
Unmarshal
(
request
.
Metadata
,
&
volcRequest
);
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"error unmarshalling metadata to volcengine request: %w"
,
err
)
}
}
jsonData
,
err
:=
json
.
Marshal
(
volcRequest
)
jsonData
,
err
:=
json
.
Marshal
(
volcRequest
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"error marshalling volcengine request: %w"
,
err
)
return
nil
,
fmt
.
Errorf
(
"error marshalling volcengine request: %w"
,
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