Przeglądaj źródła

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

1808837298@qq.com 1 rok temu
rodzic
commit
2aca637b2a
1 zmienionych plików z 8 dodań i 2 usunięć
  1. 8 2
      common/model-ratio.go

+ 8 - 2
common/model-ratio.go

@@ -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