refactor(responses): remove compact model suffix handling (#6770)
This commit is contained in:
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user