From d0910f72e14dc8723259e9a69ec29c4aa83b2c9e Mon Sep 17 00:00:00 2001 From: wood Date: Fri, 27 Oct 2023 01:21:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81ai=20gateway=E6=B8=A0?= =?UTF-8?q?=E9=81=93=E7=9A=84=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/channel-test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/controller/channel-test.go b/controller/channel-test.go index ae4ab7d5..e901085c 100644 --- a/controller/channel-test.go +++ b/controller/channel-test.go @@ -11,7 +11,7 @@ import ( "strconv" "sync" "time" - + "strings" "github.com/gin-gonic/gin" ) @@ -47,8 +47,11 @@ func testChannel(channel *model.Channel, request ChatRequest) (err error, openai } else { if channel.GetBaseURL() != "" { requestURL = channel.GetBaseURL() + if !strings.HasPrefix(requestURL, "https://gateway.ai.cloudflare.com") { + requestURL += "/v1" + } } - requestURL += "/v1/chat/completions" + requestURL += "/chat/completions" } jsonData, err := json.Marshal(request)