From bcd46f0cf71ebcff8ade9503cabbb4fbadbd048f Mon Sep 17 00:00:00 2001 From: glzjin Date: Thu, 17 Aug 2023 23:00:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8function=5Fcall=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=E6=97=B6=E4=B8=8D=E8=AE=A1=E8=B4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/relay-openai.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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