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
4c0d0956
authored
Mar 02, 2024
by
1808837298@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: add missing UpstreamModelName
parent
05986fcc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 additions
and
4 deletions
+1
-4
middleware/distributor.go
+0
-2
relay/common/relay_info.go
+0
-2
relay/relay-text.go
+1
-0
No files found.
middleware/distributor.go
View file @
4c0d0956
...
@@ -116,8 +116,6 @@ func Distribute() func(c *gin.Context) {
...
@@ -116,8 +116,6 @@ func Distribute() func(c *gin.Context) {
abortWithMessage
(
c
,
http
.
StatusServiceUnavailable
,
fmt
.
Sprintf
(
"当前分组 %s 下对于模型 %s 无可用渠道(数据库一致性已被破坏)"
,
userGroup
,
modelRequest
.
Model
))
abortWithMessage
(
c
,
http
.
StatusServiceUnavailable
,
fmt
.
Sprintf
(
"当前分组 %s 下对于模型 %s 无可用渠道(数据库一致性已被破坏)"
,
userGroup
,
modelRequest
.
Model
))
return
return
}
}
c
.
Set
(
"model_name"
,
modelRequest
.
Model
)
}
}
c
.
Set
(
"channel"
,
channel
.
Type
)
c
.
Set
(
"channel"
,
channel
.
Type
)
c
.
Set
(
"channel_id"
,
channel
.
Id
)
c
.
Set
(
"channel_id"
,
channel
.
Id
)
...
...
relay/common/relay_info.go
View file @
4c0d0956
...
@@ -34,7 +34,6 @@ func GenRelayInfo(c *gin.Context) *RelayInfo {
...
@@ -34,7 +34,6 @@ func GenRelayInfo(c *gin.Context) *RelayInfo {
userId
:=
c
.
GetInt
(
"id"
)
userId
:=
c
.
GetInt
(
"id"
)
group
:=
c
.
GetString
(
"group"
)
group
:=
c
.
GetString
(
"group"
)
tokenUnlimited
:=
c
.
GetBool
(
"token_unlimited_quota"
)
tokenUnlimited
:=
c
.
GetBool
(
"token_unlimited_quota"
)
upstreamModelName
:=
c
.
GetString
(
"model_name"
)
startTime
:=
time
.
Now
()
startTime
:=
time
.
Now
()
apiType
:=
constant
.
ChannelType2APIType
(
channelType
)
apiType
:=
constant
.
ChannelType2APIType
(
channelType
)
...
@@ -53,7 +52,6 @@ func GenRelayInfo(c *gin.Context) *RelayInfo {
...
@@ -53,7 +52,6 @@ func GenRelayInfo(c *gin.Context) *RelayInfo {
ApiType
:
apiType
,
ApiType
:
apiType
,
ApiVersion
:
c
.
GetString
(
"api_version"
),
ApiVersion
:
c
.
GetString
(
"api_version"
),
ApiKey
:
strings
.
TrimPrefix
(
c
.
Request
.
Header
.
Get
(
"Authorization"
),
"Bearer "
),
ApiKey
:
strings
.
TrimPrefix
(
c
.
Request
.
Header
.
Get
(
"Authorization"
),
"Bearer "
),
UpstreamModelName
:
upstreamModelName
,
}
}
if
info
.
BaseUrl
==
""
{
if
info
.
BaseUrl
==
""
{
info
.
BaseUrl
=
common
.
ChannelBaseURLs
[
channelType
]
info
.
BaseUrl
=
common
.
ChannelBaseURLs
[
channelType
]
...
...
relay/relay-text.go
View file @
4c0d0956
...
@@ -59,6 +59,7 @@ func getAndValidateTextRequest(c *gin.Context, relayInfo *relaycommon.RelayInfo)
...
@@ -59,6 +59,7 @@ func getAndValidateTextRequest(c *gin.Context, relayInfo *relaycommon.RelayInfo)
}
}
}
}
relayInfo
.
IsStream
=
textRequest
.
Stream
relayInfo
.
IsStream
=
textRequest
.
Stream
relayInfo
.
UpstreamModelName
=
textRequest
.
Model
return
textRequest
,
nil
return
textRequest
,
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