feat: enhance model ratio lookup with case-insensitive and direct matching

This commit is contained in:
1808837298@qq.com
2025-01-26 16:07:41 +08:00
parent 15918b2050
commit 2aca637b2a

View File

@@ -342,6 +342,12 @@ func UpdateCompletionRatioByJSONString(jsonStr string) error {
}
func GetCompletionRatio(name string) float64 {
if strings.Contains(name, "/") {
if ratio, ok := CompletionRatio[name]; ok {
return ratio
}
}
lowercaseName := strings.ToLower(name)
if strings.HasPrefix(name, "gpt-4-gizmo") {
name = "gpt-4-gizmo-*"
}
@@ -404,8 +410,8 @@ func GetCompletionRatio(name string) float64 {
return 4
}
}
if strings.HasPrefix(name, "deepseek") {
if strings.Contains(name, "reasoner") {
if strings.HasPrefix(lowercaseName, "deepseek") {
if strings.HasSuffix(lowercaseName, "reasoner") || strings.HasSuffix(lowercaseName, "r1") {
return 4
}
return 2