Update relay/channel/openai/adaptor.go

use review's suggestion

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
neotf
2025-06-18 15:29:19 +08:00
committed by GitHub
parent 81bc096872
commit a6363a502a

View File

@@ -160,7 +160,9 @@ func (a *Adaptor) ConvertOpenAIRequest(c *gin.Context, info *relaycommon.RelayIn
request.StreamOptions = nil request.StreamOptions = nil
} }
if info.ChannelType == common.ChannelTypeOpenRouter { if info.ChannelType == common.ChannelTypeOpenRouter {
request.Usage = json.RawMessage("{\"include\": true}") if len(request.Usage) == 0 {
request.Usage = json.RawMessage(`{"include":true}`)
}
} }
if strings.HasPrefix(request.Model, "o") { if strings.HasPrefix(request.Model, "o") {
if request.MaxCompletionTokens == 0 && request.MaxTokens != 0 { if request.MaxCompletionTokens == 0 && request.MaxTokens != 0 {