This commit is contained in:
neotf
2025-06-18 19:54:20 +08:00
parent a6363a502a
commit 37fbcb7950

View File

@@ -159,11 +159,11 @@ func (a *Adaptor) ConvertOpenAIRequest(c *gin.Context, info *relaycommon.RelayIn
if info.ChannelType != common.ChannelTypeOpenAI && info.ChannelType != common.ChannelTypeAzure { if info.ChannelType != common.ChannelTypeOpenAI && info.ChannelType != common.ChannelTypeAzure {
request.StreamOptions = nil request.StreamOptions = nil
} }
if info.ChannelType == common.ChannelTypeOpenRouter { if info.ChannelType == common.ChannelTypeOpenRouter {
if len(request.Usage) == 0 { if len(request.Usage) == 0 {
request.Usage = json.RawMessage(`{"include":true}`) 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 {
request.MaxCompletionTokens = request.MaxTokens request.MaxCompletionTokens = request.MaxTokens