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
0e6ccea0
authored
Oct 03, 2025
by
feitianbubu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: simplify unsupported test channel types
parent
b89f9296
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
39 deletions
+74
-39
constant/channel.go
+61
-0
controller/channel-test.go
+13
-39
No files found.
constant/channel.go
View file @
0e6ccea0
...
@@ -113,3 +113,64 @@ var ChannelBaseURLs = []string{
...
@@ -113,3 +113,64 @@ var ChannelBaseURLs = []string{
"https://llm.submodel.ai"
,
//53
"https://llm.submodel.ai"
,
//53
"https://ark.cn-beijing.volces.com"
,
//54
"https://ark.cn-beijing.volces.com"
,
//54
}
}
var
ChannelTypeNames
=
map
[
int
]
string
{
ChannelTypeUnknown
:
"Unknown"
,
ChannelTypeOpenAI
:
"OpenAI"
,
ChannelTypeMidjourney
:
"Midjourney"
,
ChannelTypeAzure
:
"Azure"
,
ChannelTypeOllama
:
"Ollama"
,
ChannelTypeMidjourneyPlus
:
"MidjourneyPlus"
,
ChannelTypeOpenAIMax
:
"OpenAIMax"
,
ChannelTypeOhMyGPT
:
"OhMyGPT"
,
ChannelTypeCustom
:
"Custom"
,
ChannelTypeAILS
:
"AILS"
,
ChannelTypeAIProxy
:
"AIProxy"
,
ChannelTypePaLM
:
"PaLM"
,
ChannelTypeAPI2GPT
:
"API2GPT"
,
ChannelTypeAIGC2D
:
"AIGC2D"
,
ChannelTypeAnthropic
:
"Anthropic"
,
ChannelTypeBaidu
:
"Baidu"
,
ChannelTypeZhipu
:
"Zhipu"
,
ChannelTypeAli
:
"Ali"
,
ChannelTypeXunfei
:
"Xunfei"
,
ChannelType360
:
"360"
,
ChannelTypeOpenRouter
:
"OpenRouter"
,
ChannelTypeAIProxyLibrary
:
"AIProxyLibrary"
,
ChannelTypeFastGPT
:
"FastGPT"
,
ChannelTypeTencent
:
"Tencent"
,
ChannelTypeGemini
:
"Gemini"
,
ChannelTypeMoonshot
:
"Moonshot"
,
ChannelTypeZhipu_v4
:
"ZhipuV4"
,
ChannelTypePerplexity
:
"Perplexity"
,
ChannelTypeLingYiWanWu
:
"LingYiWanWu"
,
ChannelTypeAws
:
"AWS"
,
ChannelTypeCohere
:
"Cohere"
,
ChannelTypeMiniMax
:
"MiniMax"
,
ChannelTypeSunoAPI
:
"SunoAPI"
,
ChannelTypeDify
:
"Dify"
,
ChannelTypeJina
:
"Jina"
,
ChannelCloudflare
:
"Cloudflare"
,
ChannelTypeSiliconFlow
:
"SiliconFlow"
,
ChannelTypeVertexAi
:
"VertexAI"
,
ChannelTypeMistral
:
"Mistral"
,
ChannelTypeDeepSeek
:
"DeepSeek"
,
ChannelTypeMokaAI
:
"MokaAI"
,
ChannelTypeVolcEngine
:
"VolcEngine"
,
ChannelTypeBaiduV2
:
"BaiduV2"
,
ChannelTypeXinference
:
"Xinference"
,
ChannelTypeXai
:
"xAI"
,
ChannelTypeCoze
:
"Coze"
,
ChannelTypeKling
:
"Kling"
,
ChannelTypeJimeng
:
"Jimeng"
,
ChannelTypeVidu
:
"Vidu"
,
ChannelTypeSubmodel
:
"Submodel"
,
ChannelTypeDoubaoVideo
:
"DoubaoVideo"
,
}
func
GetChannelTypeName
(
channelType
int
)
string
{
if
name
,
ok
:=
ChannelTypeNames
[
channelType
];
ok
{
return
name
}
return
"Unknown"
}
controller/channel-test.go
View file @
0e6ccea0
...
@@ -28,6 +28,7 @@ import (
...
@@ -28,6 +28,7 @@ import (
"time"
"time"
"github.com/bytedance/gopkg/util/gopool"
"github.com/bytedance/gopkg/util/gopool"
"github.com/samber/lo"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin"
)
)
...
@@ -40,46 +41,19 @@ type testResult struct {
...
@@ -40,46 +41,19 @@ type testResult struct {
func
testChannel
(
channel
*
model
.
Channel
,
testModel
string
,
endpointType
string
)
testResult
{
func
testChannel
(
channel
*
model
.
Channel
,
testModel
string
,
endpointType
string
)
testResult
{
tik
:=
time
.
Now
()
tik
:=
time
.
Now
()
if
channel
.
Type
==
constant
.
ChannelTypeMidjourney
{
var
unsupportedTestChannelTypes
=
[]
int
{
constant
.
ChannelTypeMidjourney
,
constant
.
ChannelTypeMidjourneyPlus
,
constant
.
ChannelTypeSunoAPI
,
constant
.
ChannelTypeKling
,
constant
.
ChannelTypeJimeng
,
constant
.
ChannelTypeDoubaoVideo
,
constant
.
ChannelTypeVidu
,
}
if
lo
.
Contains
(
unsupportedTestChannelTypes
,
channel
.
Type
)
{
channelTypeName
:=
constant
.
GetChannelTypeName
(
channel
.
Type
)
return
testResult
{
return
testResult
{
localErr
:
errors
.
New
(
"midjourney channel test is not supported"
),
localErr
:
fmt
.
Errorf
(
"%s channel test is not supported"
,
channelTypeName
),
newAPIError
:
nil
,
}
}
if
channel
.
Type
==
constant
.
ChannelTypeMidjourneyPlus
{
return
testResult
{
localErr
:
errors
.
New
(
"midjourney plus channel test is not supported"
),
newAPIError
:
nil
,
}
}
if
channel
.
Type
==
constant
.
ChannelTypeSunoAPI
{
return
testResult
{
localErr
:
errors
.
New
(
"suno channel test is not supported"
),
newAPIError
:
nil
,
}
}
if
channel
.
Type
==
constant
.
ChannelTypeKling
{
return
testResult
{
localErr
:
errors
.
New
(
"kling channel test is not supported"
),
newAPIError
:
nil
,
}
}
if
channel
.
Type
==
constant
.
ChannelTypeJimeng
{
return
testResult
{
localErr
:
errors
.
New
(
"jimeng channel test is not supported"
),
newAPIError
:
nil
,
}
}
if
channel
.
Type
==
constant
.
ChannelTypeDoubaoVideo
{
return
testResult
{
localErr
:
errors
.
New
(
"doubao video channel test is not supported"
),
newAPIError
:
nil
,
}
}
if
channel
.
Type
==
constant
.
ChannelTypeVidu
{
return
testResult
{
localErr
:
errors
.
New
(
"vidu channel test is not supported"
),
newAPIError
:
nil
,
}
}
}
}
w
:=
httptest
.
NewRecorder
()
w
:=
httptest
.
NewRecorder
()
...
...
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