修改额度汇率的展现形式
This commit is contained in:
parent
cecd3700d7
commit
0facecce69
@ -15,7 +15,7 @@ var Footer = ""
|
|||||||
var Logo = ""
|
var Logo = ""
|
||||||
var TopUpLink = ""
|
var TopUpLink = ""
|
||||||
var ChatLink = ""
|
var ChatLink = ""
|
||||||
var QuotaPerUnit = 0.002 // $0.002 / 1K tokens
|
var QuotaPerUnit = 500 * 1000.0 // $0.002 / 1K tokens
|
||||||
var DisplayInCurrencyEnabled = false
|
var DisplayInCurrencyEnabled = false
|
||||||
|
|
||||||
var UsingSQLite = false
|
var UsingSQLite = false
|
||||||
|
@ -45,7 +45,7 @@ func FatalLog(v ...any) {
|
|||||||
|
|
||||||
func LogQuota(quota int) string {
|
func LogQuota(quota int) string {
|
||||||
if DisplayInCurrencyEnabled {
|
if DisplayInCurrencyEnabled {
|
||||||
return fmt.Sprintf("$%.6f 额度", float64(quota)/1000*QuotaPerUnit)
|
return fmt.Sprintf("$%.6f 额度", float64(quota)/QuotaPerUnit)
|
||||||
} else {
|
} else {
|
||||||
return fmt.Sprintf("%d 点额度", quota)
|
return fmt.Sprintf("%d 点额度", quota)
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ func GetSubscription(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
amount := float64(quota)
|
amount := float64(quota)
|
||||||
if common.DisplayInCurrencyEnabled {
|
if common.DisplayInCurrencyEnabled {
|
||||||
amount = amount / 1000 * common.QuotaPerUnit
|
amount /= common.QuotaPerUnit
|
||||||
}
|
}
|
||||||
subscription := OpenAISubscriptionResponse{
|
subscription := OpenAISubscriptionResponse{
|
||||||
Object: "billing_subscription",
|
Object: "billing_subscription",
|
||||||
@ -49,7 +49,7 @@ func GetUsage(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
amount := float64(quota)
|
amount := float64(quota)
|
||||||
if common.DisplayInCurrencyEnabled {
|
if common.DisplayInCurrencyEnabled {
|
||||||
amount = amount / 1000 * common.QuotaPerUnit
|
amount /= common.QuotaPerUnit
|
||||||
}
|
}
|
||||||
usage := OpenAIUsageResponse{
|
usage := OpenAIUsageResponse{
|
||||||
Object: "list",
|
Object: "list",
|
||||||
|
@ -43,7 +43,7 @@ export function renderQuota(quota, digits = 2) {
|
|||||||
quotaPerUnit = parseFloat(quotaPerUnit);
|
quotaPerUnit = parseFloat(quotaPerUnit);
|
||||||
displayInCurrency = displayInCurrency === 'true';
|
displayInCurrency = displayInCurrency === 'true';
|
||||||
if (displayInCurrency) {
|
if (displayInCurrency) {
|
||||||
return '$' + (quota / 1000 * quotaPerUnit).toFixed(digits);
|
return '$' + (quota / quotaPerUnit).toFixed(digits);
|
||||||
}
|
}
|
||||||
return renderNumber(quota);
|
return renderNumber(quota);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user