From c9517e2fdd34551eb32c500cab317f2c6e3c6a61 Mon Sep 17 00:00:00 2001 From: Jalon Date: Thu, 20 Jun 2024 15:17:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20fix=20SparkDesk=20Function=20Call=20(?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20Spark=20Pro/Max=E5=87=BD=E6=95=B0=E8=B0=83?= =?UTF-8?q?=E7=94=A8=E5=8F=AA=E4=BC=9A=E8=BF=94=E5=9B=9E=E6=99=AE=E9=80=9A?= =?UTF-8?q?=E5=AF=B9=E8=AF=9D=E5=9B=9E=E7=AD=94=E8=80=8C=E4=B8=8D=E6=98=AF?= =?UTF-8?q?Function=20Call=E5=9B=9E=E7=AD=94=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- relay/adaptor/xunfei/main.go | 6 +++++- relay/adaptor/xunfei/model.go | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/relay/adaptor/xunfei/main.go b/relay/adaptor/xunfei/main.go index 00122d5e..39b76e27 100644 --- a/relay/adaptor/xunfei/main.go +++ b/relay/adaptor/xunfei/main.go @@ -45,8 +45,12 @@ func requestOpenAI2Xunfei(request model.GeneralOpenAIRequest, xunfeiAppId string xunfeiRequest.Payload.Message.Text = messages if strings.HasPrefix(domain, "generalv3") { + functions := make([]model.Function, len(request.Tools)) + for i, tool := range request.Tools { + functions[i] = tool.Function + } xunfeiRequest.Payload.Functions = &Functions{ - Text: request.Tools, + Text: functions, } } diff --git a/relay/adaptor/xunfei/model.go b/relay/adaptor/xunfei/model.go index 681c0c05..1f37c046 100644 --- a/relay/adaptor/xunfei/model.go +++ b/relay/adaptor/xunfei/model.go @@ -10,7 +10,7 @@ type Message struct { } type Functions struct { - Text []model.Tool `json:"text,omitempty"` + Text []model.Function `json:"text,omitempty"` } type ChatRequest struct {