chore: move file search tool price to operation_setting
This commit is contained in:
@@ -376,9 +376,7 @@ func postConsumeQuota(ctx *gin.Context, relayInfo *relaycommon.RelayInfo,
|
|||||||
var dFileSearchQuota decimal.Decimal
|
var dFileSearchQuota decimal.Decimal
|
||||||
if relayInfo.ResponsesUsageInfo != nil {
|
if relayInfo.ResponsesUsageInfo != nil {
|
||||||
if fileSearchTool, exists := relayInfo.ResponsesUsageInfo.BuiltInTools[dto.BuildInToolFileSearch]; exists && fileSearchTool.CallCount > 0 {
|
if fileSearchTool, exists := relayInfo.ResponsesUsageInfo.BuiltInTools[dto.BuildInToolFileSearch]; exists && fileSearchTool.CallCount > 0 {
|
||||||
// file search tool 调用价格 $2.50/1k calls
|
dFileSearchQuota = decimal.NewFromFloat(operation_setting.GetFileSearchPricePerThousand()).
|
||||||
// 计算 file search tool 调用的配额 (配额 = 价格 * 调用次数 / 1000)
|
|
||||||
dFileSearchQuota = decimal.NewFromFloat(2.5).
|
|
||||||
Mul(decimal.NewFromInt(int64(fileSearchTool.CallCount))).
|
Mul(decimal.NewFromInt(int64(fileSearchTool.CallCount))).
|
||||||
Div(decimal.NewFromInt(1000))
|
Div(decimal.NewFromInt(1000))
|
||||||
extraContent += fmt.Sprintf("File Search 调用 %d 次,调用花费 $%s",
|
extraContent += fmt.Sprintf("File Search 调用 %d 次,调用花费 $%s",
|
||||||
|
|||||||
@@ -3,12 +3,15 @@ package operation_setting
|
|||||||
import "strings"
|
import "strings"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
// Web search
|
||||||
WebSearchHighTierModelPriceLow = 30.00
|
WebSearchHighTierModelPriceLow = 30.00
|
||||||
WebSearchHighTierModelPriceMedium = 35.00
|
WebSearchHighTierModelPriceMedium = 35.00
|
||||||
WebSearchHighTierModelPriceHigh = 50.00
|
WebSearchHighTierModelPriceHigh = 50.00
|
||||||
WebSearchPriceLow = 25.00
|
WebSearchPriceLow = 25.00
|
||||||
WebSearchPriceMedium = 27.50
|
WebSearchPriceMedium = 27.50
|
||||||
WebSearchPriceHigh = 30.00
|
WebSearchPriceHigh = 30.00
|
||||||
|
// File search
|
||||||
|
FileSearchPrice = 2.5
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetWebSearchPricePerThousand(modelName string, contextSize string) float64 {
|
func GetWebSearchPricePerThousand(modelName string, contextSize string) float64 {
|
||||||
@@ -48,3 +51,7 @@ func GetWebSearchPricePerThousand(modelName string, contextSize string) float64
|
|||||||
}
|
}
|
||||||
return priceWebSearchPerThousandCalls
|
return priceWebSearchPerThousandCalls
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetFileSearchPricePerThousand() float64 {
|
||||||
|
return FileSearchPrice
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user