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
dcbfba1c
authored
Jul 01, 2024
by
CalciumIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 完善日志扣费计算过程
parent
054c96d6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
web/src/helpers/render.js
+8
-7
No files found.
web/src/helpers/render.js
View file @
dcbfba1c
...
...
@@ -144,28 +144,29 @@ export function renderModelPrice(
)
{
// 1 ratio = $0.002 / 1K tokens
if
(
modelPrice
!==
-
1
)
{
return
'模型价格:$'
+
modelPrice
*
groupRatio
;
return
'模型价格:$'
+
modelPrice
+
' * 分组倍率:'
+
groupRatio
+
' = $'
+
modelPrice
*
groupRatio
;
}
else
{
if
(
completionRatio
===
undefined
)
{
completionRatio
=
0
;
}
// 这里的 *2 是因为 1倍率=0.002刀,请勿删除
let
inputRatioPrice
=
modelRatio
*
2.0
*
groupRatio
;
let
completionRatioPrice
=
modelRatio
*
2.0
*
completionRatio
*
groupRatio
;
let
inputRatioPrice
=
modelRatio
*
2.0
;
let
completionRatioPrice
=
modelRatio
*
2.0
*
completionRatio
;
let
price
=
(
inputTokens
/
1000000
)
*
inputRatioPrice
+
(
completionTokens
/
1000000
)
*
completionRatioPrice
;
return
(
<>
<
article
>
<
p
>
提示
$
{
inputRatioPrice
}
/ 1M tokens</
p
>
<
p
>
补全
$
{
completionRatioPrice
}
/ 1M tokens</
p
>
<
p
>
提示
:
$
{
inputRatioPrice
}
*
{
groupRatio
}
=
$
{
inputRatioPrice
*
groupRatio
}
/ 1M tokens</
p
>
<
p
>
补全
:
$
{
completionRatioPrice
}
*
{
groupRatio
}
=
$
{
completionRatioPrice
*
groupRatio
}
/ 1M tokens</
p
>
<
p
><
/p
>
<
p
>
提示
{
inputTokens
}
tokens
/
1
M
tokens
*
$
{
inputRatioPrice
}
+
补全
{
' '
}
{
completionTokens
}
tokens
/
1
M
tokens
*
$
{
completionRatioPrice
}
=
$
{
price
.
toFixed
(
6
)}
{
completionTokens
}
tokens
/
1
M
tokens
*
$
{
completionRatioPrice
}
*
分组
{
groupRatio
}
=
$
{
price
.
toFixed
(
6
)}
<
/p
>
<
p
>
仅供参考,以实际扣费为准
<
/p
>
<
/article
>
<
/
>
);
...
...
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