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

This commit is contained in:
JustSong committed 2023-04-28 17:25:05 +08:00
1 parent 52e92554ac
commit 0760dcf6cc
4 files changed
+21 -1

No files matched your search

+1 -1
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
}