在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,9 +52,11 @@ func openaiStreamHandler(c *gin.Context, resp *http.Response, relayMode int) (*O
}
for _, choice := range streamResponse.Choices {
responseText += choice.Delta.Content
if choice.Delta.FunctionCall != nil {
responseFunctionCallName += choice.Delta.FunctionCall.Name
responseFunctionCallArguments += choice.Delta.FunctionCall.Arguments
}
}
case RelayModeCompletions:
var streamResponse CompletionsStreamResponse
err := json.Unmarshal([]byte(data), &streamResponse)