From 3bda738ec1bff880435ce0f9d086780fe7ae9efd Mon Sep 17 00:00:00 2001 From: Seefs <40468931+seefs001@users.noreply.github.com> Date: Thu, 9 Apr 2026 14:34:14 +0800 Subject: [PATCH] fix: prefer explicit pricing for compact models (#4156) --- setting/ratio_setting/model_ratio.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/setting/ratio_setting/model_ratio.go b/setting/ratio_setting/model_ratio.go index 62fc8b3e..6899d92c 100644 --- a/setting/ratio_setting/model_ratio.go +++ b/setting/ratio_setting/model_ratio.go @@ -361,6 +361,10 @@ func UpdateModelPriceByJSONString(jsonStr string) error { func GetModelPrice(name string, printErr bool) (float64, bool) { name = FormatMatchingModelName(name) + if price, ok := modelPriceMap.Get(name); ok { + return price, true + } + if strings.HasSuffix(name, CompactModelSuffix) { price, ok := modelPriceMap.Get(CompactWildcardModelKey) if !ok { @@ -372,14 +376,10 @@ func GetModelPrice(name string, printErr bool) (float64, bool) { return price, true } - price, ok := modelPriceMap.Get(name) - if !ok { - if printErr { - common.SysError("model price not found: " + name) - } - return -1, false + if printErr { + common.SysError("model price not found: " + name) } - return price, true + return -1, false } func UpdateModelRatioByJSONString(jsonStr string) error {