feat: support custom base url for channels

This commit is contained in:
JustSong
2023-06-20 22:32:56 +08:00
parent 634099e592
commit e398f470a1
3 changed files with 16 additions and 8 deletions

View File

@@ -30,12 +30,8 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
}
baseURL := common.ChannelBaseURLs[channelType]
requestURL := c.Request.URL.String()
if channelType == common.ChannelTypeCustom {
if c.GetString("base_url") != "" {
baseURL = c.GetString("base_url")
} else if channelType == common.ChannelTypeOpenAI {
if c.GetString("base_url") != "" {
baseURL = c.GetString("base_url")
}
}
fullRequestURL := fmt.Sprintf("%s%s", baseURL, requestURL)
if channelType == common.ChannelTypeAzure {