fix: no skipping from free model price.
This commit is contained in:
parent
5730b2a798
commit
f67f4b8caf
@ -684,14 +684,15 @@ func SyncZenmuxRatios(c *gin.Context) {
|
|||||||
completionRatioMap = make(map[string]float64)
|
completionRatioMap = make(map[string]float64)
|
||||||
}
|
}
|
||||||
|
|
||||||
updated, skipped := 0, 0
|
updated := 0
|
||||||
for _, item := range catalog {
|
for _, item := range catalog {
|
||||||
if item.InputPrice <= 0 {
|
// Only overwrite existing non-zero ratio if new price is also non-zero.
|
||||||
skipped++
|
// This preserves manually configured ratios for models where Zenmux reports price=0
|
||||||
continue
|
// (e.g. per-image billing models whose token price is not tracked here).
|
||||||
|
if item.InputPrice > 0 || modelRatioMap[item.Id] == 0 {
|
||||||
|
modelRatioMap[item.Id] = item.InputPrice
|
||||||
}
|
}
|
||||||
modelRatioMap[item.Id] = item.InputPrice
|
if item.InputPrice > 0 && item.OutputPrice > 0 {
|
||||||
if item.OutputPrice > 0 {
|
|
||||||
completionRatioMap[item.Id] = item.OutputPrice / item.InputPrice
|
completionRatioMap[item.Id] = item.OutputPrice / item.InputPrice
|
||||||
}
|
}
|
||||||
updated++
|
updated++
|
||||||
@ -727,7 +728,7 @@ func SyncZenmuxRatios(c *gin.Context) {
|
|||||||
|
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
"success": true,
|
"success": true,
|
||||||
"message": fmt.Sprintf("synced ratios for %d models (%d skipped — no pricing)", updated, skipped),
|
"message": fmt.Sprintf("synced ratios for %d models", updated),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user