diff --git a/controller/relay-openai.go b/controller/relay-openai.go index fe4f2729..7552010c 100644 --- a/controller/relay-openai.go +++ b/controller/relay-openai.go @@ -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