Merge pull request #4412 from xyfacai/fix/image-n
fix(image): only price image model use N ratio
This commit is contained in:
@@ -122,9 +122,11 @@ func ImageHelper(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *type
|
|||||||
// calculation (both price-based and ratio-based paths).
|
// calculation (both price-based and ratio-based paths).
|
||||||
// Adaptors may have already set a more accurate count from the
|
// Adaptors may have already set a more accurate count from the
|
||||||
// upstream response; only set the default when they haven't.
|
// upstream response; only set the default when they haven't.
|
||||||
|
if info.PriceData.UsePrice { // only price model use N ratio
|
||||||
if _, hasN := info.PriceData.OtherRatios["n"]; !hasN {
|
if _, hasN := info.PriceData.OtherRatios["n"]; !hasN {
|
||||||
info.PriceData.AddOtherRatio("n", float64(imageN))
|
info.PriceData.AddOtherRatio("n", float64(imageN))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if usage.(*dto.Usage).TotalTokens == 0 {
|
if usage.(*dto.Usage).TotalTokens == 0 {
|
||||||
usage.(*dto.Usage).TotalTokens = 1
|
usage.(*dto.Usage).TotalTokens = 1
|
||||||
|
|||||||
Reference in New Issue
Block a user