fix: baseURL not working in APITypePaLM

This commit is contained in:
mrhaoji 2023-07-24 18:53:33 +08:00 committed by GitHub
parent bc2f48b1f2
commit e7c9003ccf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -142,6 +142,9 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
fullRequestURL = "https://generativelanguage.googleapis.com/v1beta2/models/chat-bison-001:generateMessage"
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"