* backend
- constant/endpoint_type.go
• Add EndpointTypeMidjourney, EndpointTypeSuno, EndpointTypeKling, EndpointTypeJimeng.
- common/endpoint_type.go
• Map Midjourney / MidjourneyPlus, SunoAPI, Kling, Jimeng channel types to the new endpoint types.
* frontend
- ModelPricing.js
• Add “Supported Endpoint Type” column.
• Implement renderSupportedEndpoints with `stringToColor` for consistent tag colors.
These changes allow `/api/pricing` and model lists to return accurate
`supported_endpoint_types` covering all non-OpenAI providers and display
them clearly in the UI.
No breaking changes.
38 lines
1.6 KiB
Go
38 lines
1.6 KiB
Go
package common
|
|
|
|
import "one-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:
|
|
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}
|
|
default:
|
|
if IsOpenAIResponseOnlyModel(modelName) {
|
|
endpointTypes = []constant.EndpointType{constant.EndpointTypeOpenAIResponse}
|
|
} else {
|
|
endpointTypes = []constant.EndpointType{constant.EndpointTypeOpenAI}
|
|
}
|
|
}
|
|
return endpointTypes
|
|
}
|