mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-17 21:53:42 +08:00
🐛 fix: Tokens may not be counted in the stream below
This commit is contained in:
@@ -131,6 +131,9 @@ func (h *mistralStreamHandler) handlerStream(rawLine *[]byte, dataChan chan stri
|
||||
|
||||
if mistralResponse.Usage != nil {
|
||||
*h.Usage = *mistralResponse.Usage
|
||||
} else {
|
||||
h.Usage.CompletionTokens += common.CountTokenText(mistralResponse.GetResponseText(), h.Request.Model)
|
||||
h.Usage.TotalTokens = h.Usage.PromptTokens + h.Usage.CompletionTokens
|
||||
}
|
||||
|
||||
stop := false
|
||||
|
||||
Reference in New Issue
Block a user