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
1d4d243f
authored
Sep 27, 2025
by
Seefs
Committed by
GitHub
Sep 27, 2025
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1886 from ShibaInu64/feature/volcengine-base-url
feat: volcengine支持自定义域名
parents
da88e746
95cbab6b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
7 deletions
+51
-7
relay/channel/volcengine/adaptor.go
+13
-6
relay/channel/volcengine/constants.go
+5
-0
web/src/components/table/channels/modals/EditChannelModal.jsx
+33
-1
No files found.
relay/channel/volcengine/adaptor.go
View file @
1d4d243f
...
@@ -9,6 +9,7 @@ import (
...
@@ -9,6 +9,7 @@ import (
"mime/multipart"
"mime/multipart"
"net/http"
"net/http"
"net/textproto"
"net/textproto"
channelconstant
"one-api/constant"
"one-api/dto"
"one-api/dto"
"one-api/relay/channel"
"one-api/relay/channel"
"one-api/relay/channel/openai"
"one-api/relay/channel/openai"
...
@@ -188,20 +189,26 @@ func (a *Adaptor) Init(info *relaycommon.RelayInfo) {
...
@@ -188,20 +189,26 @@ func (a *Adaptor) Init(info *relaycommon.RelayInfo) {
}
}
func
(
a
*
Adaptor
)
GetRequestURL
(
info
*
relaycommon
.
RelayInfo
)
(
string
,
error
)
{
func
(
a
*
Adaptor
)
GetRequestURL
(
info
*
relaycommon
.
RelayInfo
)
(
string
,
error
)
{
// 支持自定义域名,如果未设置则使用默认域名
baseUrl
:=
info
.
ChannelBaseUrl
if
baseUrl
==
""
{
baseUrl
=
channelconstant
.
ChannelBaseURLs
[
channelconstant
.
ChannelTypeVolcEngine
]
}
switch
info
.
RelayMode
{
switch
info
.
RelayMode
{
case
constant
.
RelayModeChatCompletions
:
case
constant
.
RelayModeChatCompletions
:
if
strings
.
HasPrefix
(
info
.
UpstreamModelName
,
"bot"
)
{
if
strings
.
HasPrefix
(
info
.
UpstreamModelName
,
"bot"
)
{
return
fmt
.
Sprintf
(
"%s/api/v3/bots/chat/completions"
,
info
.
ChannelB
aseUrl
),
nil
return
fmt
.
Sprintf
(
"%s/api/v3/bots/chat/completions"
,
b
aseUrl
),
nil
}
}
return
fmt
.
Sprintf
(
"%s/api/v3/chat/completions"
,
info
.
ChannelB
aseUrl
),
nil
return
fmt
.
Sprintf
(
"%s/api/v3/chat/completions"
,
b
aseUrl
),
nil
case
constant
.
RelayModeEmbeddings
:
case
constant
.
RelayModeEmbeddings
:
return
fmt
.
Sprintf
(
"%s/api/v3/embeddings"
,
info
.
ChannelB
aseUrl
),
nil
return
fmt
.
Sprintf
(
"%s/api/v3/embeddings"
,
b
aseUrl
),
nil
case
constant
.
RelayModeImagesGenerations
:
case
constant
.
RelayModeImagesGenerations
:
return
fmt
.
Sprintf
(
"%s/api/v3/images/generations"
,
info
.
ChannelB
aseUrl
),
nil
return
fmt
.
Sprintf
(
"%s/api/v3/images/generations"
,
b
aseUrl
),
nil
case
constant
.
RelayModeImagesEdits
:
case
constant
.
RelayModeImagesEdits
:
return
fmt
.
Sprintf
(
"%s/api/v3/images/edits"
,
info
.
ChannelB
aseUrl
),
nil
return
fmt
.
Sprintf
(
"%s/api/v3/images/edits"
,
b
aseUrl
),
nil
case
constant
.
RelayModeRerank
:
case
constant
.
RelayModeRerank
:
return
fmt
.
Sprintf
(
"%s/api/v3/rerank"
,
info
.
ChannelB
aseUrl
),
nil
return
fmt
.
Sprintf
(
"%s/api/v3/rerank"
,
b
aseUrl
),
nil
default
:
default
:
}
}
return
""
,
fmt
.
Errorf
(
"unsupported relay mode: %d"
,
info
.
RelayMode
)
return
""
,
fmt
.
Errorf
(
"unsupported relay mode: %d"
,
info
.
RelayMode
)
...
...
relay/channel/volcengine/constants.go
View file @
1d4d243f
...
@@ -9,6 +9,11 @@ var ModelList = []string{
...
@@ -9,6 +9,11 @@ var ModelList = []string{
"Doubao-lite-4k"
,
"Doubao-lite-4k"
,
"Doubao-embedding"
,
"Doubao-embedding"
,
"doubao-seedream-4-0-250828"
,
"doubao-seedream-4-0-250828"
,
"seedream-4-0-250828"
,
"doubao-seedance-1-0-pro-250528"
,
"seedance-1-0-pro-250528"
,
"doubao-seed-1-6-thinking-250715"
,
"seed-1-6-thinking-250715"
,
}
}
var
ChannelName
=
"volcengine"
var
ChannelName
=
"volcengine"
web/src/components/table/channels/modals/EditChannelModal.jsx
View file @
1d4d243f
...
@@ -235,7 +235,7 @@ const EditChannelModal = (props) => {
...
@@ -235,7 +235,7 @@ const EditChannelModal = (props) => {
pass_through_body_enabled
:
false
,
pass_through_body_enabled
:
false
,
system_prompt
:
''
,
system_prompt
:
''
,
});
});
const
showApiConfigCard
=
inputs
.
type
!==
45
;
// 控制是否显示 API 配置卡片(仅当渠道类型不是 豆包 时显示)
const
showApiConfigCard
=
true
;
// 控制是否显示 API 配置卡片
const
getInitValues
=
()
=>
({
...
originInputs
});
const
getInitValues
=
()
=>
({
...
originInputs
});
// 处理渠道额外设置的更新
// 处理渠道额外设置的更新
...
@@ -342,6 +342,10 @@ const EditChannelModal = (props) => {
...
@@ -342,6 +342,10 @@ const EditChannelModal = (props) => {
case
36
:
case
36
:
localModels
=
[
'suno_music'
,
'suno_lyrics'
];
localModels
=
[
'suno_music'
,
'suno_lyrics'
];
break
;
break
;
case
45
:
localModels
=
getChannelModels
(
value
);
setInputs
((
prevInputs
)
=>
({
...
prevInputs
,
base_url
:
'https://ark.cn-beijing.volces.com'
}));
break
;
default
:
default
:
localModels
=
getChannelModels
(
value
);
localModels
=
getChannelModels
(
value
);
break
;
break
;
...
@@ -842,6 +846,10 @@ const EditChannelModal = (props) => {
...
@@ -842,6 +846,10 @@ const EditChannelModal = (props) => {
showInfo
(
t
(
'请至少选择一个模型!'
));
showInfo
(
t
(
'请至少选择一个模型!'
));
return
;
return
;
}
}
if
(
localInputs
.
type
===
45
&&
(
!
localInputs
.
base_url
||
localInputs
.
base_url
.
trim
()
===
''
))
{
showInfo
(
t
(
'请输入API地址!'
));
return
;
}
if
(
if
(
localInputs
.
model_mapping
&&
localInputs
.
model_mapping
&&
localInputs
.
model_mapping
!==
''
&&
localInputs
.
model_mapping
!==
''
&&
...
@@ -1809,6 +1817,30 @@ const EditChannelModal = (props) => {
...
@@ -1809,6 +1817,30 @@ const EditChannelModal = (props) => {
/>
/>
</
div
>
</
div
>
)
}
)
}
{
inputs
.
type
===
45
&&
(
<
div
>
<
Form
.
Select
field=
'base_url'
label=
{
t
(
'API地址'
)
}
placeholder=
{
t
(
'请选择API地址'
)
}
onChange=
{
(
value
)
=>
handleInputChange
(
'base_url'
,
value
)
}
optionList=
{
[
{
value
:
'https://ark.cn-beijing.volces.com'
,
label
:
'https://ark.cn-beijing.volces.com'
},
{
value
:
'https://ark.ap-southeast.bytepluses.com'
,
label
:
'https://ark.ap-southeast.bytepluses.com'
}
]
}
defaultValue=
'https://ark.cn-beijing.volces.com'
/>
</
div
>
)
}
</
Card
>
</
Card
>
)
}
)
}
...
...
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