Publish Docker image (Multi-arch) / Build & push (amd64) (push) Failing after 1m40s
Release (Linux, macOS, Windows) / Linux Release (push) Failing after 42m16s
Publish Docker image (Multi-arch) / Build & push (arm64) (push) Canceled after 0s
Release (Linux, macOS, Windows) / macOS Release (push) Canceled after 0s
Release (Linux, macOS, Windows) / Windows Release (push) Canceled after 0s
Publish Docker image (Multi-arch) / Create multi-arch manifests (push) Canceled after 0s
Sync production source including routing, billing, Astra detection and public uptime. Update custom build instructions and license packaging.
79 lines
1.6 KiB
Go
79 lines
1.6 KiB
Go
package common
|
|
|
|
import "strings"
|
|
|
|
// ZImagePromptExtendMultiplier is the legacy Ali image request surcharge.
|
|
const ZImagePromptExtendMultiplier = 2
|
|
|
|
var (
|
|
// OpenAIResponseOnlyModels is a list of models that are only available for OpenAI responses.
|
|
OpenAIResponseOnlyModels = []string{
|
|
"o3-pro",
|
|
"o3-deep-research",
|
|
"o4-mini-deep-research",
|
|
}
|
|
ImageGenerationModels = []string{
|
|
"dall-e-3",
|
|
"dall-e-2",
|
|
"prefix:dall-e", // Deprecated upstream models; retained for compatible routes.
|
|
"gpt-image-",
|
|
"qwen-image",
|
|
"z-image",
|
|
"wan2.7-image-pro",
|
|
"wan2.7-image",
|
|
"wan2.6-image",
|
|
"wan2.6-t2i",
|
|
"wan2.5-t2i-preview",
|
|
"wan2.2-t2i-flash",
|
|
"wan2.2-t2i-plus",
|
|
"wanx2.1-t2i-turbo",
|
|
"wanx2.1-t2i-plus",
|
|
"wanx2.0-t2i-turbo",
|
|
"prefix:imagen-",
|
|
"flux-",
|
|
"flux.1-",
|
|
}
|
|
OpenAITextModels = []string{
|
|
"gpt-",
|
|
"o1",
|
|
"o3",
|
|
"o4",
|
|
"chatgpt",
|
|
}
|
|
)
|
|
|
|
func IsOpenAIResponseOnlyModel(modelName string) bool {
|
|
for _, m := range OpenAIResponseOnlyModels {
|
|
if strings.Contains(modelName, m) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsImageGenerationModel(modelName string) bool {
|
|
modelName = strings.ToLower(modelName)
|
|
for _, m := range ImageGenerationModels {
|
|
if prefix, ok := strings.CutPrefix(m, "prefix:"); ok {
|
|
if strings.HasPrefix(modelName, prefix) {
|
|
return true
|
|
}
|
|
continue
|
|
}
|
|
if strings.Contains(modelName, m) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsOpenAITextModel(modelName string) bool {
|
|
modelName = strings.ToLower(modelName)
|
|
for _, m := range OpenAITextModels {
|
|
if strings.Contains(modelName, m) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|