在function_call为空时不计费

This commit is contained in:
glzjin
2023-08-17 23:00:58 +08:00
committed by GitHub
parent 64217d1f50
commit bcd46f0cf7

View File

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