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

@@ -25,9 +25,7 @@ func testChannel(channel *model.Channel, request ChatRequest) error {
if channel.Type == common.ChannelTypeAzure {
requestURL = fmt.Sprintf("%s/openai/deployments/%s/chat/completions?api-version=2023-03-15-preview", channel.BaseURL, request.Model)
} else {
if channel.Type == common.ChannelTypeCustom {
requestURL = channel.BaseURL
} else if channel.Type == common.ChannelTypeOpenAI && channel.BaseURL != "" {
if channel.BaseURL != "" {
requestURL = channel.BaseURL
}
requestURL += "/v1/chat/completions"