From 708b25456359252b76433d93130dc5c4d1fa39d1 Mon Sep 17 00:00:00 2001 From: Edward <73746306+WangEdward@users.noreply.github.com> Date: Fri, 26 May 2023 20:38:37 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20=20Change=20if=20logic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/relay.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/controller/relay.go b/controller/relay.go index 81497d81..79abcf77 100644 --- a/controller/relay.go +++ b/controller/relay.go @@ -5,12 +5,13 @@ import ( "bytes" "encoding/json" "fmt" - "github.com/gin-gonic/gin" "io" "net/http" "one-api/common" "one-api/model" "strings" + + "github.com/gin-gonic/gin" ) type Message struct { @@ -115,7 +116,7 @@ func relayHelper(c *gin.Context) *OpenAIErrorWithStatusCode { tokenId := c.GetInt("token_id") consumeQuota := c.GetBool("consume_quota") var textRequest GeneralOpenAIRequest - if consumeQuota || channelType == common.ChannelTypeAzure || channelType == common.ChannelTypePaLM { + if c.Request.Method == http.MethodPost { requestBody, err := io.ReadAll(c.Request.Body) if err != nil { return errorWrapper(err, "read_request_body_failed", http.StatusBadRequest)