Bundle the current backend and web changes into one publishable snapshot from the server worktree so the remote mirror reflects the deployed source. Constraint: Push the existing mixed worktree from /docker/new-api/src without reshaping files Rejected: Split into feature-specific commits | current worktree is already a single undifferentiated snapshot Confidence: medium Scope-risk: moderate Directive: Split future feature work before deployment to preserve clearer history Tested: git status inspection; git diff --stat review Not-tested: build, lint, unit tests, integration tests
49 lines
2.2 KiB
Go
49 lines
2.2 KiB
Go
package common
|
|
|
|
import "github.com/QuantumNous/new-api/constant"
|
|
|
|
// GetEndpointTypesByChannelType 获取渠道最优先端点类型(所有的渠道都支持 OpenAI 端点)
|
|
func GetEndpointTypesByChannelType(channelType int, modelName string) []constant.EndpointType {
|
|
var endpointTypes []constant.EndpointType
|
|
switch channelType {
|
|
case constant.ChannelTypeJina:
|
|
endpointTypes = []constant.EndpointType{constant.EndpointTypeJinaRerank}
|
|
//case constant.ChannelTypeMidjourney, constant.ChannelTypeMidjourneyPlus:
|
|
// endpointTypes = []constant.EndpointType{constant.EndpointTypeMidjourney}
|
|
//case constant.ChannelTypeSunoAPI:
|
|
// endpointTypes = []constant.EndpointType{constant.EndpointTypeSuno}
|
|
//case constant.ChannelTypeKling:
|
|
// endpointTypes = []constant.EndpointType{constant.EndpointTypeKling}
|
|
//case constant.ChannelTypeJimeng:
|
|
// endpointTypes = []constant.EndpointType{constant.EndpointTypeJimeng}
|
|
case constant.ChannelTypeAws:
|
|
fallthrough
|
|
case constant.ChannelTypeAnthropic:
|
|
case constant.ChannelTypeClaudeCodeCLIProxy:
|
|
endpointTypes = []constant.EndpointType{constant.EndpointTypeAnthropic, constant.EndpointTypeOpenAI}
|
|
case constant.ChannelTypeVertexAi:
|
|
fallthrough
|
|
case constant.ChannelTypeGemini:
|
|
endpointTypes = []constant.EndpointType{constant.EndpointTypeGemini, constant.EndpointTypeOpenAI}
|
|
case constant.ChannelTypeOpenRouter: // OpenRouter 只支持 OpenAI 端点
|
|
endpointTypes = []constant.EndpointType{constant.EndpointTypeOpenAI}
|
|
case constant.ChannelTypeXai:
|
|
endpointTypes = []constant.EndpointType{constant.EndpointTypeOpenAI, constant.EndpointTypeOpenAIResponse}
|
|
case constant.ChannelTypeSora:
|
|
endpointTypes = []constant.EndpointType{constant.EndpointTypeOpenAIVideo}
|
|
default:
|
|
if IsOpenAIResponseOnlyModel(modelName) {
|
|
endpointTypes = []constant.EndpointType{constant.EndpointTypeOpenAIResponse}
|
|
} else {
|
|
endpointTypes = []constant.EndpointType{constant.EndpointTypeOpenAI}
|
|
}
|
|
}
|
|
if IsImageGenerationModel(modelName) {
|
|
endpointTypes = append([]constant.EndpointType{constant.EndpointTypeImageGeneration}, endpointTypes...)
|
|
}
|
|
if IsImageEditModel(modelName) {
|
|
endpointTypes = append([]constant.EndpointType{constant.EndpointTypeImageEdit}, endpointTypes...)
|
|
}
|
|
return endpointTypes
|
|
}
|