Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 

48 строки
2.2 KiB

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