mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-17 17:16:38 +08:00
feat: only allow gpt-audio stream mode when EnforceIncludeUsage is true
This commit is contained in:
parent
010bc72304
commit
bcba9bf3a1
@ -161,4 +161,5 @@ var RelayProxy = env.String("RELAY_PROXY", "")
|
||||
var UserContentRequestProxy = env.String("USER_CONTENT_REQUEST_PROXY", "")
|
||||
var UserContentRequestTimeout = env.Int("USER_CONTENT_REQUEST_TIMEOUT", 30)
|
||||
|
||||
// EnforceIncludeUsage is used to determine whether to include usage in the response
|
||||
var EnforceIncludeUsage = env.Bool("ENFORCE_INCLUDE_USAGE", false)
|
||||
|
@ -97,10 +97,10 @@ func (a *Adaptor) ConvertRequest(c *gin.Context, relayMode int, request *model.G
|
||||
}(request.Messages)
|
||||
}
|
||||
|
||||
if request.Stream && strings.HasPrefix(request.Model, "gpt-4o-audio") {
|
||||
if request.Stream && strings.HasPrefix(request.Model, "gpt-4o-audio") && !config.EnforceIncludeUsage {
|
||||
// TODO: Since it is not clear how to implement billing in stream mode,
|
||||
// it is temporarily not supported
|
||||
return nil, errors.New("stream mode is not supported for gpt-4o-audio")
|
||||
return nil, errors.New("set ENFORCE_INCLUDE_USAGE=true to enable stream mode for gpt-4o-audio")
|
||||
}
|
||||
|
||||
return request, nil
|
||||
|
Loading…
Reference in New Issue
Block a user