在function_call为空时不计费

This commit is contained in:
glzjin 2023-08-17 23:00:58 +08:00 committed by GitHub
parent 64217d1f50
commit bcd46f0cf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,8 +52,10 @@ func openaiStreamHandler(c *gin.Context, resp *http.Response, relayMode int) (*O
} }
for _, choice := range streamResponse.Choices { for _, choice := range streamResponse.Choices {
responseText += choice.Delta.Content responseText += choice.Delta.Content
responseFunctionCallName += choice.Delta.FunctionCall.Name if choice.Delta.FunctionCall != nil {
responseFunctionCallArguments += choice.Delta.FunctionCall.Arguments responseFunctionCallName += choice.Delta.FunctionCall.Name
responseFunctionCallArguments += choice.Delta.FunctionCall.Arguments
}
} }
case RelayModeCompletions: case RelayModeCompletions:
var streamResponse CompletionsStreamResponse var streamResponse CompletionsStreamResponse