✨ feat(endpoint types): add support for image generation models in endpoint type handling
This commit is contained in:
@@ -33,5 +33,9 @@ func GetEndpointTypesByChannelType(channelType int, modelName string) []constant
|
|||||||
endpointTypes = []constant.EndpointType{constant.EndpointTypeOpenAI}
|
endpointTypes = []constant.EndpointType{constant.EndpointTypeOpenAI}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if IsImageGenerationModel(modelName) {
|
||||||
|
// add to first
|
||||||
|
endpointTypes = append([]constant.EndpointType{constant.EndpointTypeImageGeneration}, endpointTypes...)
|
||||||
|
}
|
||||||
return endpointTypes
|
return endpointTypes
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,11 +9,32 @@ var (
|
|||||||
"o3-deep-research",
|
"o3-deep-research",
|
||||||
"o4-mini-deep-research",
|
"o4-mini-deep-research",
|
||||||
}
|
}
|
||||||
|
ImageGenerationModels = []string{
|
||||||
|
"dall-e-3",
|
||||||
|
"dall-e-2",
|
||||||
|
"gpt-image-1",
|
||||||
|
"prefix:imagen-",
|
||||||
|
"flux-",
|
||||||
|
"flux.1-",
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func IsOpenAIResponseOnlyModel(modelName string) bool {
|
func IsOpenAIResponseOnlyModel(modelName string) bool {
|
||||||
for _, m := range OpenAIResponseOnlyModels {
|
for _, m := range OpenAIResponseOnlyModels {
|
||||||
if strings.Contains(m, modelName) {
|
if strings.Contains(modelName, m) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func IsImageGenerationModel(modelName string) bool {
|
||||||
|
modelName = strings.ToLower(modelName)
|
||||||
|
for _, m := range ImageGenerationModels {
|
||||||
|
if strings.Contains(modelName, m) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if strings.HasPrefix(m, "prefix:") && strings.HasPrefix(modelName, strings.TrimPrefix(m, "prefix:")) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,12 @@ package constant
|
|||||||
type EndpointType string
|
type EndpointType string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
EndpointTypeOpenAI EndpointType = "openai"
|
EndpointTypeOpenAI EndpointType = "openai"
|
||||||
EndpointTypeOpenAIResponse EndpointType = "openai-response"
|
EndpointTypeOpenAIResponse EndpointType = "openai-response"
|
||||||
EndpointTypeAnthropic EndpointType = "anthropic"
|
EndpointTypeAnthropic EndpointType = "anthropic"
|
||||||
EndpointTypeGemini EndpointType = "gemini"
|
EndpointTypeGemini EndpointType = "gemini"
|
||||||
EndpointTypeJinaRerank EndpointType = "jina-rerank"
|
EndpointTypeJinaRerank EndpointType = "jina-rerank"
|
||||||
|
EndpointTypeImageGeneration EndpointType = "image-generation"
|
||||||
//EndpointTypeMidjourney EndpointType = "midjourney-proxy"
|
//EndpointTypeMidjourney EndpointType = "midjourney-proxy"
|
||||||
//EndpointTypeSuno EndpointType = "suno-proxy"
|
//EndpointTypeSuno EndpointType = "suno-proxy"
|
||||||
//EndpointTypeKling EndpointType = "kling"
|
//EndpointTypeKling EndpointType = "kling"
|
||||||
|
|||||||
Reference in New Issue
Block a user