GetEndpointTypesByChannelType 获取渠道最优先端点类型(所有的渠道都支持 OpenAI 端点)
(channelType int, modelName string)
| 4 | |
| 5 | // GetEndpointTypesByChannelType 获取渠道最优先端点类型(所有的渠道都支持 OpenAI 端点) |
| 6 | func GetEndpointTypesByChannelType(channelType int, modelName string) []constant.EndpointType { |
| 7 | var endpointTypes []constant.EndpointType |
| 8 | switch channelType { |
| 9 | case constant.ChannelTypeJina: |
| 10 | endpointTypes = []constant.EndpointType{constant.EndpointTypeJinaRerank} |
| 11 | //case constant.ChannelTypeMidjourney, constant.ChannelTypeMidjourneyPlus: |
| 12 | // endpointTypes = []constant.EndpointType{constant.EndpointTypeMidjourney} |
| 13 | //case constant.ChannelTypeSunoAPI: |
| 14 | // endpointTypes = []constant.EndpointType{constant.EndpointTypeSuno} |
| 15 | //case constant.ChannelTypeKling: |
| 16 | // endpointTypes = []constant.EndpointType{constant.EndpointTypeKling} |
| 17 | //case constant.ChannelTypeJimeng: |
| 18 | // endpointTypes = []constant.EndpointType{constant.EndpointTypeJimeng} |
| 19 | case constant.ChannelTypeAws: |
| 20 | fallthrough |
| 21 | case constant.ChannelTypeAnthropic: |
| 22 | endpointTypes = []constant.EndpointType{constant.EndpointTypeAnthropic, constant.EndpointTypeOpenAI} |
| 23 | case constant.ChannelTypeVertexAi: |
| 24 | fallthrough |
| 25 | case constant.ChannelTypeGemini: |
| 26 | endpointTypes = []constant.EndpointType{constant.EndpointTypeGemini, constant.EndpointTypeOpenAI} |
| 27 | case constant.ChannelTypeOpenRouter: // OpenRouter 只支持 OpenAI 端点 |
| 28 | endpointTypes = []constant.EndpointType{constant.EndpointTypeOpenAI} |
| 29 | default: |
| 30 | if IsOpenAIResponseOnlyModel(modelName) { |
| 31 | endpointTypes = []constant.EndpointType{constant.EndpointTypeOpenAIResponse} |
| 32 | } else { |
| 33 | endpointTypes = []constant.EndpointType{constant.EndpointTypeOpenAI} |
| 34 | } |
| 35 | } |
| 36 | if IsImageGenerationModel(modelName) { |
| 37 | // add to first |
| 38 | endpointTypes = append([]constant.EndpointType{constant.EndpointTypeImageGeneration}, endpointTypes...) |
| 39 | } |
| 40 | return endpointTypes |
| 41 | } |
no test coverage detected