|
|
|
@@ -370,6 +370,17 @@ func GetModelPrice(name string, printErr bool) (float64, bool) { |
|
|
|
|
|
|
|
price, ok := modelPriceMap.Get(name) |
|
|
|
if !ok { |
|
|
|
// 新增:如果模型名称包含 "/",尝试去掉供应商前缀后重新查找 |
|
|
|
// 例如: "openai/gpt-4o" -> "gpt-4o" |
|
|
|
if strings.Contains(name, "/") { |
|
|
|
parts := strings.SplitN(name, "/", 2) |
|
|
|
if len(parts) == 2 { |
|
|
|
baseName := FormatMatchingModelName(parts[1]) |
|
|
|
if basePrice, ok := modelPriceMap.Get(baseName); ok { |
|
|
|
return basePrice, true |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if printErr { |
|
|
|
common.SysError("model price not found: " + name) |
|
|
|
} |
|
|
|
@@ -401,6 +412,17 @@ func GetModelRatio(name string) (float64, bool, string) { |
|
|
|
} |
|
|
|
//return 0, true, name |
|
|
|
} |
|
|
|
// 新增:如果模型名称包含 "/",尝试去掉供应商前缀后重新查找 |
|
|
|
// 例如: "openai/o3-mini" -> "o3-mini" |
|
|
|
if strings.Contains(name, "/") { |
|
|
|
parts := strings.SplitN(name, "/", 2) |
|
|
|
if len(parts) == 2 { |
|
|
|
baseName := FormatMatchingModelName(parts[1]) |
|
|
|
if baseRatio, ok := modelRatioMap.Get(baseName); ok { |
|
|
|
return baseRatio, true, name |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return 37.5, operation_setting.SelfUseModeEnabled, name |
|
|
|
} |
|
|
|
return ratio, true, name |
|
|
|
|