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
8cebbde4
authored
May 06, 2025
by
creamlike1024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: move file search tool price to operation_setting
parent
1db30c55
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
relay/relay-text.go
+1
-3
setting/operation_setting/tools.go
+7
-0
No files found.
relay/relay-text.go
View file @
8cebbde4
...
...
@@ -376,9 +376,7 @@ func postConsumeQuota(ctx *gin.Context, relayInfo *relaycommon.RelayInfo,
var
dFileSearchQuota
decimal
.
Decimal
if
relayInfo
.
ResponsesUsageInfo
!=
nil
{
if
fileSearchTool
,
exists
:=
relayInfo
.
ResponsesUsageInfo
.
BuiltInTools
[
dto
.
BuildInToolFileSearch
];
exists
&&
fileSearchTool
.
CallCount
>
0
{
// file search tool 调用价格 $2.50/1k calls
// 计算 file search tool 调用的配额 (配额 = 价格 * 调用次数 / 1000)
dFileSearchQuota
=
decimal
.
NewFromFloat
(
2.5
)
.
dFileSearchQuota
=
decimal
.
NewFromFloat
(
operation_setting
.
GetFileSearchPricePerThousand
())
.
Mul
(
decimal
.
NewFromInt
(
int64
(
fileSearchTool
.
CallCount
)))
.
Div
(
decimal
.
NewFromInt
(
1000
))
extraContent
+=
fmt
.
Sprintf
(
"File Search 调用 %d 次,调用花费 $%s"
,
...
...
setting/operation_setting/tools.go
View file @
8cebbde4
...
...
@@ -3,12 +3,15 @@ package operation_setting
import
"strings"
const
(
// Web search
WebSearchHighTierModelPriceLow
=
30.00
WebSearchHighTierModelPriceMedium
=
35.00
WebSearchHighTierModelPriceHigh
=
50.00
WebSearchPriceLow
=
25.00
WebSearchPriceMedium
=
27.50
WebSearchPriceHigh
=
30.00
// File search
FileSearchPrice
=
2.5
)
func
GetWebSearchPricePerThousand
(
modelName
string
,
contextSize
string
)
float64
{
...
...
@@ -48,3 +51,7 @@ func GetWebSearchPricePerThousand(modelName string, contextSize string) float64
}
return
priceWebSearchPerThousandCalls
}
func
GetFileSearchPricePerThousand
()
float64
{
return
FileSearchPrice
}
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