feat: sync deployed v1.0.0-rc.38-custom.42
Sync production source including routing, billing, Astra detection and public uptime. Update custom build instructions and license packaging.
This commit is contained in:
1 parent
aa6c3f50f4
commit
ceddfd3d6b
828 files changed
+122253
-13702
No files matched your search
@@ -4,6 +4,11 @@ import (
|
||||
"github.com/QuantumNous/new-api/types"
|
||||
)
|
||||
|
||||
const (
|
||||
DefaultCacheRatio = 1.0
|
||||
DefaultCreateCacheRatio = 1.25
|
||||
)
|
||||
|
||||
var defaultCacheRatio = map[string]float64{
|
||||
"gemini-3-flash-preview": 0.1,
|
||||
"gemini-3-pro-preview": 0.1,
|
||||
@@ -159,7 +164,7 @@ func UpdateCreateCacheRatioByJSONString(jsonStr string) error {
|
||||
func GetCacheRatio(name string) (float64, bool) {
|
||||
ratio, ok := cacheRatioMap.Get(name)
|
||||
if !ok {
|
||||
return 1, false // Default to 1 if not found
|
||||
return DefaultCacheRatio, false
|
||||
}
|
||||
return ratio, true
|
||||
}
|
||||
@@ -167,7 +172,7 @@ func GetCacheRatio(name string) (float64, bool) {
|
||||
func GetCreateCacheRatio(name string) (float64, bool) {
|
||||
ratio, ok := createCacheRatioMap.Get(name)
|
||||
if !ok {
|
||||
return 1.25, false // Default to 1.25 if not found
|
||||
return DefaultCreateCacheRatio, false
|
||||
}
|
||||
return ratio, true
|
||||
}
|
||||
|
||||
@@ -434,21 +434,7 @@ func UpdateCompletionRatioByJSONString(jsonStr string) error {
|
||||
}
|
||||
|
||||
func GetCompletionRatio(name string) float64 {
|
||||
name = FormatMatchingModelName(name)
|
||||
|
||||
if strings.Contains(name, "/") {
|
||||
if ratio, ok := completionRatioMap.Get(name); ok {
|
||||
return ratio
|
||||
}
|
||||
}
|
||||
hardCodedRatio, contain := getHardcodedCompletionModelRatio(name)
|
||||
if contain {
|
||||
return hardCodedRatio
|
||||
}
|
||||
if ratio, ok := completionRatioMap.Get(name); ok {
|
||||
return ratio
|
||||
}
|
||||
return hardCodedRatio
|
||||
return GetCompletionRatioInfo(name).Ratio
|
||||
}
|
||||
|
||||
type CompletionRatioInfo struct {
|
||||
@@ -458,14 +444,19 @@ type CompletionRatioInfo struct {
|
||||
|
||||
func GetCompletionRatioInfo(name string) CompletionRatioInfo {
|
||||
name = FormatMatchingModelName(name)
|
||||
var configured *float64
|
||||
if ratio, ok := completionRatioMap.Get(name); ok {
|
||||
configured = &ratio
|
||||
}
|
||||
return ResolveCompletionRatio(name, configured)
|
||||
}
|
||||
|
||||
if strings.Contains(name, "/") {
|
||||
if ratio, ok := completionRatioMap.Get(name); ok {
|
||||
return CompletionRatioInfo{
|
||||
Ratio: ratio,
|
||||
Locked: false,
|
||||
}
|
||||
}
|
||||
// ResolveCompletionRatio applies relay's enforced and fallback ratios to a
|
||||
// configuration snapshot or draft without consulting mutable saved settings.
|
||||
func ResolveCompletionRatio(name string, configured *float64) CompletionRatioInfo {
|
||||
name = FormatMatchingModelName(name)
|
||||
if strings.Contains(name, "/") && configured != nil {
|
||||
return CompletionRatioInfo{Ratio: *configured}
|
||||
}
|
||||
|
||||
hardCodedRatio, locked := getHardcodedCompletionModelRatio(name)
|
||||
@@ -476,9 +467,9 @@ func GetCompletionRatioInfo(name string) CompletionRatioInfo {
|
||||
}
|
||||
}
|
||||
|
||||
if ratio, ok := completionRatioMap.Get(name); ok {
|
||||
if configured != nil {
|
||||
return CompletionRatioInfo{
|
||||
Ratio: ratio,
|
||||
Ratio: *configured,
|
||||
Locked: false,
|
||||
}
|
||||
}
|
||||
@@ -664,10 +655,12 @@ func UpdateImageRatioByJSONString(jsonStr string) error {
|
||||
return types.LoadFromJsonString(imageRatioMap, jsonStr)
|
||||
}
|
||||
|
||||
const DefaultImageRatio = 1.0
|
||||
|
||||
func GetImageRatio(name string) (float64, bool) {
|
||||
ratio, ok := imageRatioMap.Get(name)
|
||||
if !ok {
|
||||
return 1, false // Default to 1 if not found
|
||||
return DefaultImageRatio, false
|
||||
}
|
||||
return ratio, true
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user