From 64217d1f501ed7d6b27af7c5d9d4c1b95ebb19aa Mon Sep 17 00:00:00 2001 From: glzjin Date: Thu, 17 Aug 2023 23:00:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=20function=5Fcall=20=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E6=97=B6=E4=B8=8D=E5=9C=A8=E6=B5=81=E4=B8=AD=E8=BF=94?= =?UTF-8?q?=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/relay.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/controller/relay.go b/controller/relay.go index 11145ae8..363d8611 100644 --- a/controller/relay.go +++ b/controller/relay.go @@ -34,10 +34,6 @@ type Function struct { Parameters Parameter `json:"parameters"` } -type FunctionCall struct { - Name string `json:"name"` -} - const ( RelayModeUnknown = iota RelayModeChatCompletions @@ -145,13 +141,15 @@ type ImageResponse struct { } } +type FunctionCall struct { + Name string `json:"name,omitempty"` + Arguments string `json:"arguments,omitempty"` +} + type ChatCompletionsStreamResponseChoice struct { Delta struct { - Content string `json:"content"` - FunctionCall struct { - Name string `json:"name"` - Arguments string `json:"arguments"` - } `json:"function_call"` + Content string `json:"content"` + FunctionCall *FunctionCall `json:"function_call,omitempty"` } `json:"delta"` FinishReason *string `json:"finish_reason"` }