refactor(responses): remove compact model suffix handling (#6770)

This commit is contained in:
Seefs
2026-08-11 13:42:32 +08:00
committed by GitHub
parent 253a74dd1b
commit bb234ff418
10 changed files with 21 additions and 133 deletions
-34
View File
@@ -1,34 +0,0 @@
package ratio_setting
import "strings"
const CompactModelSuffix = "-openai-compact"
const CompactWildcardModelKey = "*" + CompactModelSuffix
func WithCompactModelSuffix(modelName string) string {
if strings.HasSuffix(modelName, CompactModelSuffix) {
return modelName
}
return modelName + CompactModelSuffix
}
func WithCompactModelVariants(models []string) []string {
variants := make([]string, 0, len(models)*2)
seen := make(map[string]struct{}, len(models)*2)
for _, model := range models {
if _, ok := seen[model]; ok {
continue
}
seen[model] = struct{}{}
variants = append(variants, model)
}
for _, model := range models {
compactModel := WithCompactModelSuffix(model)
if _, ok := seen[compactModel]; ok {
continue
}
seen[compactModel] = struct{}{}
variants = append(variants, compactModel)
}
return variants
}
-17
View File
@@ -364,17 +364,6 @@ func GetModelPrice(name string, printErr bool) (float64, bool) {
return price, true
}
if strings.HasSuffix(name, CompactModelSuffix) {
price, ok := modelPriceMap.Get(CompactWildcardModelKey)
if !ok {
if printErr {
common.SysError("model price not found: " + name)
}
return -1, false
}
return price, true
}
if printErr {
common.SysError("model price not found: " + name)
}
@@ -398,12 +387,6 @@ func GetModelRatio(name string) (float64, bool, string) {
ratio, ok := modelRatioMap.Get(name)
if !ok {
if strings.HasSuffix(name, CompactModelSuffix) {
if wildcardRatio, ok := modelRatioMap.Get(CompactWildcardModelKey); ok {
return wildcardRatio, true, name
}
//return 0, true, name
}
return 37.5, operation_setting.SelfUseModeEnabled, name
}
return ratio, true, name