fix: use channel type to determine api type (close #321)

This commit is contained in:
JustSong 2023-07-24 23:34:14 +08:00
parent 929e43ef81
commit c134604cee

View File

@ -85,13 +85,14 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
}
}
apiType := APITypeOpenAI
if strings.HasPrefix(textRequest.Model, "claude") {
switch channelType {
case common.ChannelTypeAnthropic:
apiType = APITypeClaude
} else if strings.HasPrefix(textRequest.Model, "ERNIE") {
case common.ChannelTypeBaidu:
apiType = APITypeBaidu
} else if strings.HasPrefix(textRequest.Model, "PaLM") {
case common.ChannelTypePaLM:
apiType = APITypePaLM
} else if strings.HasPrefix(textRequest.Model, "chatglm_") {
case common.ChannelTypeZhipu:
apiType = APITypeZhipu
}
baseURL := common.ChannelBaseURLs[channelType]