fix: 修复自定义渠道出错 #243

This commit is contained in:
CaIon
2024-05-13 14:32:32 +08:00
parent e8800415b8
commit fd19798c92
5 changed files with 11 additions and 17 deletions

View File

@@ -24,19 +24,11 @@ const (
APITypeDummy // this one is only for count, do not add any channel after this
)
func ChannelType2APIType(channelType int) int {
func ChannelType2APIType(channelType int) (int, bool) {
apiType := -1
switch channelType {
case common.ChannelTypeOpenAI:
apiType = APITypeOpenAI
case common.ChannelTypeAzure:
apiType = APITypeOpenAI
case common.ChannelTypeMoonshot:
apiType = APITypeOpenAI
case common.ChannelTypeLingYiWanWu:
apiType = APITypeOpenAI
case common.ChannelType360:
apiType = APITypeOpenAI
case common.ChannelTypeAnthropic:
apiType = APITypeAnthropic
case common.ChannelTypeBaidu:
@@ -66,5 +58,8 @@ func ChannelType2APIType(channelType int) int {
case common.ChannelTypeCohere:
apiType = APITypeCohere
}
return apiType
if apiType == -1 {
return APITypeOpenAI, false
}
return apiType, true
}