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
Unverified
Commit
63ce2db9
authored
Apr 24, 2026
by
feitianbubu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: model pricing use correct display type
parent
65b16547
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
6 deletions
+19
-6
web/src/components/table/model-pricing/modal/components/DynamicPricingBreakdown.jsx
+4
-5
web/src/helpers/utils.jsx
+15
-1
No files found.
web/src/components/table/model-pricing/modal/components/DynamicPricingBreakdown.jsx
View file @
63ce2db9
...
@@ -20,7 +20,7 @@ For commercial licensing, please contact support@quantumnous.com
...
@@ -20,7 +20,7 @@ For commercial licensing, please contact support@quantumnous.com
import
React
from
'react'
;
import
React
from
'react'
;
import
{
Avatar
,
Tag
,
Table
,
Typography
}
from
'@douyinfe/semi-ui'
;
import
{
Avatar
,
Tag
,
Table
,
Typography
}
from
'@douyinfe/semi-ui'
;
import
{
IconPriceTag
}
from
'@douyinfe/semi-icons'
;
import
{
IconPriceTag
}
from
'@douyinfe/semi-icons'
;
import
{
parseTiersFromExpr
}
from
'../../../../../helpers'
;
import
{
parseTiersFromExpr
,
getCurrencyConfig
}
from
'../../../../../helpers'
;
import
{
BILLING_VARS
}
from
'../../../../../constants'
;
import
{
BILLING_VARS
}
from
'../../../../../constants'
;
import
{
import
{
splitBillingExprAndRequestRules
,
splitBillingExprAndRequestRules
,
...
@@ -36,8 +36,6 @@ import {
...
@@ -36,8 +36,6 @@ import {
const
{
Text
}
=
Typography
;
const
{
Text
}
=
Typography
;
const
PRICE_SUFFIX
=
'$/1M tokens'
;
const
VAR_LABELS
=
{
p
:
'输入'
,
c
:
'输出'
};
const
VAR_LABELS
=
{
p
:
'输入'
,
c
:
'输出'
};
const
OP_LABELS
=
{
'<'
:
'<'
,
'<='
:
'≤'
,
'>'
:
'>'
,
'>='
:
'≥'
};
const
OP_LABELS
=
{
'<'
:
'<'
,
'<='
:
'≤'
,
'>'
:
'>'
,
'>='
:
'≥'
};
const
TIME_FUNC_LABELS
=
{
hour
:
'小时'
,
minute
:
'分钟'
,
weekday
:
'星期'
,
month
:
'月份'
,
day
:
'日期'
};
const
TIME_FUNC_LABELS
=
{
hour
:
'小时'
,
minute
:
'分钟'
,
weekday
:
'星期'
,
month
:
'月份'
,
day
:
'日期'
};
...
@@ -89,6 +87,7 @@ function describeGroup(group, t) {
...
@@ -89,6 +87,7 @@ function describeGroup(group, t) {
}
}
export
default
function
DynamicPricingBreakdown
({
billingExpr
,
t
})
{
export
default
function
DynamicPricingBreakdown
({
billingExpr
,
t
})
{
const
{
symbol
,
rate
}
=
getCurrencyConfig
();
const
{
billingExpr
:
baseExpr
,
requestRuleExpr
:
ruleExpr
}
=
const
{
billingExpr
:
baseExpr
,
requestRuleExpr
:
ruleExpr
}
=
splitBillingExprAndRequestRules
(
billingExpr
||
''
);
splitBillingExprAndRequestRules
(
billingExpr
||
''
);
...
@@ -132,9 +131,9 @@ export default function DynamicPricingBreakdown({ billingExpr, t }) {
...
@@ -132,9 +131,9 @@ export default function DynamicPricingBreakdown({ billingExpr, t }) {
...
priceFields
...
priceFields
.
filter
(([
field
])
=>
hasTiers
&&
tiers
.
some
((
tier
)
=>
tier
[
field
]
>
0
))
.
filter
(([
field
])
=>
hasTiers
&&
tiers
.
some
((
tier
)
=>
tier
[
field
]
>
0
))
.
map
(([
field
,
label
])
=>
({
.
map
(([
field
,
label
])
=>
({
title
:
`
${
t
(
label
)}
(
${
PRICE_SUFFIX
}
)`
,
title
:
`
${
t
(
label
)}
(
${
symbol
}
/1M tokens
)`
,
dataIndex
:
field
,
dataIndex
:
field
,
render
:
(
v
)
=>
v
>
0
?
<
Text
strong
>
$
{
v
.
toFixed
(
4
)
}
</
Text
>
:
'-'
,
render
:
(
v
)
=>
v
>
0
?
<
Text
strong
>
{
`${symbol}${(v * rate).toFixed(4)}`
}
</
Text
>
:
'-'
,
})),
})),
];
];
...
...
web/src/helpers/utils.jsx
View file @
63ce2db9
...
@@ -900,6 +900,20 @@ export const getModelPriceItems = (
...
@@ -900,6 +900,20 @@ export const getModelPriceItems = (
export
const
formatDynamicPriceSummary
=
(
billingExpr
,
t
,
groupRatio
=
1
)
=>
{
export
const
formatDynamicPriceSummary
=
(
billingExpr
,
t
,
groupRatio
=
1
)
=>
{
if
(
!
billingExpr
)
return
<
span
style=
{
{
color
:
'var(--semi-color-text-1)'
}
}
>
{
t
(
'动态计费'
)
}
</
span
>;
if
(
!
billingExpr
)
return
<
span
style=
{
{
color
:
'var(--semi-color-text-1)'
}
}
>
{
t
(
'动态计费'
)
}
</
span
>;
const
quotaDisplayType
=
localStorage
.
getItem
(
'quota_display_type'
)
||
'USD'
;
let
symbol
=
'$'
;
let
rate
=
1
;
try
{
const
s
=
JSON
.
parse
(
localStorage
.
getItem
(
'status'
)
||
'{}'
);
if
(
quotaDisplayType
===
'CNY'
)
{
symbol
=
'¥'
;
rate
=
s
?.
usd_exchange_rate
||
7
;
}
else
if
(
quotaDisplayType
===
'CUSTOM'
)
{
symbol
=
s
?.
custom_currency_symbol
||
'¤'
;
rate
=
s
?.
custom_currency_exchange_rate
||
1
;
}
}
catch
(
e
)
{}
const
gr
=
groupRatio
||
1
;
const
gr
=
groupRatio
||
1
;
const
exprBody
=
billingExpr
.
replace
(
/^v
\d
+:/
,
''
);
const
exprBody
=
billingExpr
.
replace
(
/^v
\d
+:/
,
''
);
const
tierMatches
=
exprBody
.
match
(
/tier
\(
/g
)
||
[];
const
tierMatches
=
exprBody
.
match
(
/tier
\(
/g
)
||
[];
...
@@ -933,7 +947,7 @@ export const formatDynamicPriceSummary = (billingExpr, t, groupRatio = 1) => {
...
@@ -933,7 +947,7 @@ export const formatDynamicPriceSummary = (billingExpr, t, groupRatio = 1) => {
{
varLabels
.
map
(([
key
,
label
])
=>
{
varLabels
.
map
(([
key
,
label
])
=>
key
in
varCoeffs
?
(
key
in
varCoeffs
?
(
<
span
key=
{
key
}
style=
{
lineStyle
}
>
<
span
key=
{
key
}
style=
{
lineStyle
}
>
{
t
(
label
)
}
$
{
(
varCoeffs
[
key
]
*
gr
).
toFixed
(
4
)
}{
unitSuffix
}
{
`${t(label)} ${symbol}${(varCoeffs[key] * gr * rate).toFixed(4)}${unitSuffix}`
}
</
span
>
</
span
>
)
:
null
,
)
:
null
,
)
}
)
}
...
...
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