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
4f7c4d64
authored
Mar 03, 2026
by
Calcium-Ion
Committed by
GitHub
Mar 03, 2026
Browse files
Options
Browse Files
Download
Plain Diff
fix: use default model price for radio price model (#3090)
parents
70821e20
c79c1f95
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
10 deletions
+8
-10
relay/helper/price.go
+8
-10
No files found.
relay/helper/price.go
View file @
4f7c4d64
...
...
@@ -147,24 +147,22 @@ func ModelPriceHelperPerCall(c *gin.Context, info *relaycommon.RelayInfo) (types
// 如果没有配置价格,检查模型倍率配置
if
!
success
{
// 没有配置费用,
返回错误
// 没有配置费用,
也要使用默认费用,否则按费率计费模型无法使用
defaultPrice
,
ok
:=
ratio_setting
.
GetDefaultModelPriceMap
()[
info
.
OriginModelName
]
if
!
ok
{
// 不再使用默认价格,而是返回错误
return
types
.
PriceData
{},
fmt
.
Errorf
(
"模型 %s 价格未配置,请联系管理员设置"
,
info
.
OriginModelName
)
}
else
{
if
ok
{
modelPrice
=
defaultPrice
}
// 没有配置倍率也不接受没配置,那就返回错误
_
,
ratioSuccess
,
matchName
:=
ratio_setting
.
GetModelRatio
(
info
.
OriginModelName
)
if
!
ratioSuccess
{
}
else
{
// 没有配置倍率也不接受没配置,那就返回错误
_
,
ratioSuccess
,
matchName
:=
ratio_setting
.
GetModelRatio
(
info
.
OriginModelName
)
acceptUnsetRatio
:=
false
if
info
.
UserSetting
.
AcceptUnsetRatioModel
{
acceptUnsetRatio
=
true
}
if
!
acceptUnsetRatio
{
if
!
ratioSuccess
&&
!
acceptUnsetRatio
{
return
types
.
PriceData
{},
fmt
.
Errorf
(
"模型 %s 倍率或价格未配置,请联系管理员设置或开始自用模式;Model %s ratio or price not set, please set or start self-use mode"
,
matchName
,
matchName
)
}
// 未配置价格但配置了倍率,使用默认预扣价格
modelPrice
=
float64
(
common
.
PreConsumedQuota
)
/
common
.
QuotaPerUnit
}
}
...
...
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