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
97cbe9b5
authored
May 28, 2025
by
Apple\Apple
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/main' into ui/refactor
parents
369e0564
8a6b4c38
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
9 deletions
+22
-9
controller/channel.go
+4
-1
dto/openai_request.go
+1
-0
relay/channel/vertex/adaptor.go
+17
-8
No files found.
controller/channel.go
View file @
97cbe9b5
...
@@ -119,8 +119,11 @@ func FetchUpstreamModels(c *gin.Context) {
...
@@ -119,8 +119,11 @@ func FetchUpstreamModels(c *gin.Context) {
baseURL
=
channel
.
GetBaseURL
()
baseURL
=
channel
.
GetBaseURL
()
}
}
url
:=
fmt
.
Sprintf
(
"%s/v1/models"
,
baseURL
)
url
:=
fmt
.
Sprintf
(
"%s/v1/models"
,
baseURL
)
if
channel
.
Type
==
common
.
ChannelTypeGemini
{
switch
channel
.
Type
{
case
common
.
ChannelTypeGemini
:
url
=
fmt
.
Sprintf
(
"%s/v1beta/openai/models"
,
baseURL
)
url
=
fmt
.
Sprintf
(
"%s/v1beta/openai/models"
,
baseURL
)
case
common
.
ChannelTypeAli
:
url
=
fmt
.
Sprintf
(
"%s/compatible-mode/v1/models"
,
baseURL
)
}
}
body
,
err
:=
GetResponseBody
(
"GET"
,
url
,
channel
,
GetAuthHeader
(
channel
.
Key
))
body
,
err
:=
GetResponseBody
(
"GET"
,
url
,
channel
,
GetAuthHeader
(
channel
.
Key
))
if
err
!=
nil
{
if
err
!=
nil
{
...
...
dto/openai_request.go
View file @
97cbe9b5
...
@@ -43,6 +43,7 @@ type GeneralOpenAIRequest struct {
...
@@ -43,6 +43,7 @@ type GeneralOpenAIRequest struct {
ResponseFormat
*
ResponseFormat
`json:"response_format,omitempty"`
ResponseFormat
*
ResponseFormat
`json:"response_format,omitempty"`
EncodingFormat
any
`json:"encoding_format,omitempty"`
EncodingFormat
any
`json:"encoding_format,omitempty"`
Seed
float64
`json:"seed,omitempty"`
Seed
float64
`json:"seed,omitempty"`
ParallelTooCalls
bool
`json:"parallel_tool_calls,omitempty"`
Tools
[]
ToolCallRequest
`json:"tools,omitempty"`
Tools
[]
ToolCallRequest
`json:"tools,omitempty"`
ToolChoice
any
`json:"tool_choice,omitempty"`
ToolChoice
any
`json:"tool_choice,omitempty"`
User
string
`json:"user,omitempty"`
User
string
`json:"user,omitempty"`
...
...
relay/channel/vertex/adaptor.go
View file @
97cbe9b5
...
@@ -95,14 +95,23 @@ func (a *Adaptor) GetRequestURL(info *relaycommon.RelayInfo) (string, error) {
...
@@ -95,14 +95,23 @@ func (a *Adaptor) GetRequestURL(info *relaycommon.RelayInfo) (string, error) {
}
else
{
}
else
{
suffix
=
"generateContent"
suffix
=
"generateContent"
}
}
return
fmt
.
Sprintf
(
if
region
==
"global"
{
"https://%s-aiplatform.googleapis.com/v1/projects/%s/locations/%s/publishers/google/models/%s:%s"
,
return
fmt
.
Sprintf
(
region
,
"https://aiplatform.googleapis.com/v1/projects/%s/locations/global/publishers/google/models/%s:%s"
,
adc
.
ProjectID
,
adc
.
ProjectID
,
region
,
info
.
UpstreamModelName
,
info
.
UpstreamModelName
,
suffix
,
suffix
,
),
nil
),
nil
}
else
{
return
fmt
.
Sprintf
(
"https://%s-aiplatform.googleapis.com/v1/projects/%s/locations/%s/publishers/google/models/%s:%s"
,
region
,
adc
.
ProjectID
,
region
,
info
.
UpstreamModelName
,
suffix
,
),
nil
}
}
else
if
a
.
RequestMode
==
RequestModeClaude
{
}
else
if
a
.
RequestMode
==
RequestModeClaude
{
if
info
.
IsStream
{
if
info
.
IsStream
{
suffix
=
"streamRawPredict?alt=sse"
suffix
=
"streamRawPredict?alt=sse"
...
...
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