mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-04-19 06:27:27 +00:00
Merge branch 'feature/messages2responses' into upstream-main
# Conflicts: # service/openaicompat/chat_to_responses.go
This commit is contained in:
@@ -110,6 +110,23 @@ func ClaudeHelper(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *typ
|
||||
}
|
||||
}
|
||||
|
||||
if !model_setting.GetGlobalSettings().PassThroughRequestEnabled &&
|
||||
!info.ChannelSetting.PassThroughBodyEnabled &&
|
||||
service.ShouldChatCompletionsUseResponsesGlobal(info.ChannelId, info.ChannelType, info.OriginModelName) {
|
||||
openAIRequest, convErr := service.ClaudeToOpenAIRequest(*request, info)
|
||||
if convErr != nil {
|
||||
return types.NewError(convErr, types.ErrorCodeConvertRequestFailed, types.ErrOptionWithSkipRetry())
|
||||
}
|
||||
|
||||
usage, newApiErr := chatCompletionsViaResponses(c, info, adaptor, openAIRequest)
|
||||
if newApiErr != nil {
|
||||
return newApiErr
|
||||
}
|
||||
|
||||
service.PostClaudeConsumeQuota(c, info, usage)
|
||||
return nil
|
||||
}
|
||||
|
||||
var requestBody io.Reader
|
||||
if model_setting.GetGlobalSettings().PassThroughRequestEnabled || info.ChannelSetting.PassThroughBodyEnabled {
|
||||
body, err := common.GetRequestBody(c)
|
||||
|
||||
Reference in New Issue
Block a user