Merge remote-tracking branch 'upstream/alpha' into update-gemini-ratio

This commit is contained in:
RedwindA
2025-06-19 20:02:27 +08:00
40 changed files with 856 additions and 374 deletions

View File

@@ -1,8 +1,45 @@
package setting
import "encoding/json"
var PayAddress = ""
var CustomCallbackAddress = ""
var EpayId = ""
var EpayKey = ""
var Price = 7.3
var MinTopUp = 1
var PayMethods = []map[string]string{
{
"name": "支付宝",
"color": "rgba(var(--semi-blue-5), 1)",
"type": "zfb",
},
{
"name": "微信",
"color": "rgba(var(--semi-green-5), 1)",
"type": "wx",
},
}
func UpdatePayMethodsByJsonString(jsonString string) error {
PayMethods = make([]map[string]string, 0)
return json.Unmarshal([]byte(jsonString), &PayMethods)
}
func PayMethods2JsonString() string {
jsonBytes, err := json.Marshal(PayMethods)
if err != nil {
return "[]"
}
return string(jsonBytes)
}
func ContainsPayMethod(method string) bool {
for _, payMethod := range PayMethods {
if payMethod["type"] == method {
return true
}
}
return false
}

View File

@@ -1,4 +1,4 @@
package operation_setting
package ratio_setting
import (
"encoding/json"

View File

@@ -1,4 +1,4 @@
package setting
package ratio_setting
import (
"encoding/json"

View File

@@ -1,8 +1,9 @@
package operation_setting
package ratio_setting
import (
"encoding/json"
"one-api/common"
"one-api/setting/operation_setting"
"strings"
"sync"
)
@@ -369,7 +370,7 @@ func GetModelRatio(name string) (float64, bool) {
}
ratio, ok := modelRatioMap[name]
if !ok {
return 37.5, SelfUseModeEnabled
return 37.5, operation_setting.SelfUseModeEnabled
}
return ratio, true
}