feat: support configuring ratio when estimating token number in stream mode

This commit is contained in:
JustSong
2023-04-28 17:25:05 +08:00
parent 23ec541ba6
commit 480e789cd8
4 changed files with 21 additions and 1 deletions

View File

@@ -110,7 +110,7 @@ func relayHelper(c *gin.Context) error {
if consumeQuota {
quota := 0
if isStream {
quota = int(float64(len(streamResponseText)) * 0.8)
quota = int(float64(len(streamResponseText)) * common.BytesNumber2Quota)
} else {
quota = textResponse.Usage.TotalTokens
}