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
2869dbf6
authored
Feb 15, 2025
by
1808837298@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: Enhance VolcEngine channel support with bot model routing (fix #757)
parent
9e2433e2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletions
+5
-1
relay/channel/openai/relay-openai.go
+1
-1
relay/channel/volcengine/adaptor.go
+4
-0
No files found.
relay/channel/openai/relay-openai.go
View file @
2869dbf6
...
@@ -90,7 +90,7 @@ func OaiStreamHandler(c *gin.Context, resp *http.Response, info *relaycommon.Rel
...
@@ -90,7 +90,7 @@ func OaiStreamHandler(c *gin.Context, resp *http.Response, info *relaycommon.Rel
if
len
(
data
)
<
6
{
// ignore blank line or wrong format
if
len
(
data
)
<
6
{
// ignore blank line or wrong format
continue
continue
}
}
if
data
[
:
5
]
!=
"data:
"
&&
data
[
:
6
]
!=
"[DONE]"
{
if
data
[
:
5
]
!=
"data:"
&&
data
[
:
6
]
!=
"[DONE]"
{
continue
continue
}
}
mu
.
Lock
()
mu
.
Lock
()
...
...
relay/channel/volcengine/adaptor.go
View file @
2869dbf6
...
@@ -11,6 +11,7 @@ import (
...
@@ -11,6 +11,7 @@ import (
"one-api/relay/channel/openai"
"one-api/relay/channel/openai"
relaycommon
"one-api/relay/common"
relaycommon
"one-api/relay/common"
"one-api/relay/constant"
"one-api/relay/constant"
"strings"
)
)
type
Adaptor
struct
{
type
Adaptor
struct
{
...
@@ -32,6 +33,9 @@ func (a *Adaptor) Init(info *relaycommon.RelayInfo) {
...
@@ -32,6 +33,9 @@ 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
)
{
switch
info
.
RelayMode
{
switch
info
.
RelayMode
{
case
constant
.
RelayModeChatCompletions
:
case
constant
.
RelayModeChatCompletions
:
if
strings
.
HasPrefix
(
info
.
UpstreamModelName
,
"bot"
)
{
return
fmt
.
Sprintf
(
"%s/api/v3/bots/chat/completions"
,
info
.
BaseUrl
),
nil
}
return
fmt
.
Sprintf
(
"%s/api/v3/chat/completions"
,
info
.
BaseUrl
),
nil
return
fmt
.
Sprintf
(
"%s/api/v3/chat/completions"
,
info
.
BaseUrl
),
nil
case
constant
.
RelayModeEmbeddings
:
case
constant
.
RelayModeEmbeddings
:
return
fmt
.
Sprintf
(
"%s/api/v3/embeddings"
,
info
.
BaseUrl
),
nil
return
fmt
.
Sprintf
(
"%s/api/v3/embeddings"
,
info
.
BaseUrl
),
nil
...
...
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