Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
95775a5a
authored
Jul 05, 2025
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat(endpoint types): add support for image generation models in endpoint type handling
parent
14cca53e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
6 deletions
+32
-6
common/endpoint_type.go
+4
-0
common/model.go
+22
-1
constant/endpoint_type.go
+6
-5
No files found.
common/endpoint_type.go
View file @
95775a5a
...
...
@@ -33,5 +33,9 @@ func GetEndpointTypesByChannelType(channelType int, modelName string) []constant
endpointTypes
=
[]
constant
.
EndpointType
{
constant
.
EndpointTypeOpenAI
}
}
}
if
IsImageGenerationModel
(
modelName
)
{
// add to first
endpointTypes
=
append
([]
constant
.
EndpointType
{
constant
.
EndpointTypeImageGeneration
},
endpointTypes
...
)
}
return
endpointTypes
}
common/model.go
View file @
95775a5a
...
...
@@ -9,11 +9,32 @@ var (
"o3-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
{
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
}
}
...
...
constant/endpoint_type.go
View file @
95775a5a
...
...
@@ -3,11 +3,12 @@ package constant
type
EndpointType
string
const
(
EndpointTypeOpenAI
EndpointType
=
"openai"
EndpointTypeOpenAIResponse
EndpointType
=
"openai-response"
EndpointTypeAnthropic
EndpointType
=
"anthropic"
EndpointTypeGemini
EndpointType
=
"gemini"
EndpointTypeJinaRerank
EndpointType
=
"jina-rerank"
EndpointTypeOpenAI
EndpointType
=
"openai"
EndpointTypeOpenAIResponse
EndpointType
=
"openai-response"
EndpointTypeAnthropic
EndpointType
=
"anthropic"
EndpointTypeGemini
EndpointType
=
"gemini"
EndpointTypeJinaRerank
EndpointType
=
"jina-rerank"
EndpointTypeImageGeneration
EndpointType
=
"image-generation"
//EndpointTypeMidjourney EndpointType = "midjourney-proxy"
//EndpointTypeSuno EndpointType = "suno-proxy"
//EndpointTypeKling EndpointType = "kling"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment