From e80c13d37f326b5b7a4a697b47a5398b1d65d1f6 Mon Sep 17 00:00:00 2001 From: JustSong Date: Mon, 24 Jul 2023 22:37:35 +0800 Subject: [PATCH] chore: use the same logic as claude --- controller/relay-text.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/controller/relay-text.go b/controller/relay-text.go index 961d9517..25a10679 100644 --- a/controller/relay-text.go +++ b/controller/relay-text.go @@ -140,11 +140,11 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode { fullRequestURL += "?access_token=" + apiKey // TODO: access token expire in 30 days case APITypePaLM: fullRequestURL = "https://generativelanguage.googleapis.com/v1beta2/models/chat-bison-001:generateMessage" + if baseURL != "" { + fullRequestURL = fmt.Sprintf("%s/v1beta2/models/chat-bison-001:generateMessage", baseURL) + } apiKey := c.Request.Header.Get("Authorization") apiKey = strings.TrimPrefix(apiKey, "Bearer ") - if baseURL != "" { - fullRequestURL = strings.Replace(fullRequestURL, "https://generativelanguage.googleapis.com", baseURL, 1) - } fullRequestURL += "?key=" + apiKey case APITypeZhipu: method := "invoke"