GetModelPrice 返回模型的价格,如果模型不存在则返回-1,false
(name string, printErr bool)
| 331 | |
| 332 | // GetModelPrice 返回模型的价格,如果模型不存在则返回-1,false |
| 333 | func GetModelPrice(name string, printErr bool) (float64, bool) { |
| 334 | modelPriceMapMutex.RLock() |
| 335 | defer modelPriceMapMutex.RUnlock() |
| 336 | |
| 337 | if strings.HasPrefix(name, "gpt-4-gizmo") { |
| 338 | name = "gpt-4-gizmo-*" |
| 339 | } |
| 340 | if strings.HasPrefix(name, "gpt-4o-gizmo") { |
| 341 | name = "gpt-4o-gizmo-*" |
| 342 | } |
| 343 | price, ok := modelPriceMap[name] |
| 344 | if !ok { |
| 345 | if printErr { |
| 346 | common.SysError("model price not found: " + name) |
| 347 | } |
| 348 | return -1, false |
| 349 | } |
| 350 | return price, true |
| 351 | } |
| 352 | |
| 353 | func UpdateModelRatioByJSONString(jsonStr string) error { |
| 354 | modelRatioMapMutex.Lock() |
no test coverage detected