mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-18 06:03:42 +08:00
🐛 fix: Tokens may not be counted in the stream below
This commit is contained in:
@@ -189,6 +189,9 @@ func (h *CohereStreamHandler) convertToOpenaiStream(cohereResponse *CohereStream
|
||||
Role: types.ChatMessageRoleAssistant,
|
||||
Content: cohereResponse.Text,
|
||||
}
|
||||
|
||||
h.Usage.CompletionTokens += common.CountTokenText(cohereResponse.Text, h.Request.Model)
|
||||
h.Usage.TotalTokens = h.Usage.PromptTokens + h.Usage.CompletionTokens
|
||||
}
|
||||
|
||||
chatCompletion := types.ChatCompletionStreamResponse{
|
||||
|
||||
Reference in New Issue
Block a user