Commit 3bda738e by Seefs Committed by GitHub

fix: prefer explicit pricing for compact models (#4156)

parent 160cb285
...@@ -361,6 +361,10 @@ func UpdateModelPriceByJSONString(jsonStr string) error { ...@@ -361,6 +361,10 @@ func UpdateModelPriceByJSONString(jsonStr string) error {
func GetModelPrice(name string, printErr bool) (float64, bool) { func GetModelPrice(name string, printErr bool) (float64, bool) {
name = FormatMatchingModelName(name) name = FormatMatchingModelName(name)
if price, ok := modelPriceMap.Get(name); ok {
return price, true
}
if strings.HasSuffix(name, CompactModelSuffix) { if strings.HasSuffix(name, CompactModelSuffix) {
price, ok := modelPriceMap.Get(CompactWildcardModelKey) price, ok := modelPriceMap.Get(CompactWildcardModelKey)
if !ok { if !ok {
...@@ -372,14 +376,10 @@ func GetModelPrice(name string, printErr bool) (float64, bool) { ...@@ -372,14 +376,10 @@ func GetModelPrice(name string, printErr bool) (float64, bool) {
return price, true return price, true
} }
price, ok := modelPriceMap.Get(name) if printErr {
if !ok { common.SysError("model price not found: " + name)
if printErr {
common.SysError("model price not found: " + name)
}
return -1, false
} }
return price, true return -1, false
} }
func UpdateModelRatioByJSONString(jsonStr string) error { func UpdateModelRatioByJSONString(jsonStr string) error {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment