Skip to content

Commit

Permalink
fix: use channel type to determine api type (close #321)
Browse files Browse the repository at this point in the history
  • Loading branch information
songquanpeng committed Jul 24, 2023
1 parent 929e43e commit c134604
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions controller/relay-text.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit c134604

Please sign in to comment.