mirror of
https://github.com/linux-do/new-api.git
synced 2025-11-12 00:53:41 +08:00
merge upstream
Signed-off-by: wozulong <>
This commit is contained in:
@@ -232,7 +232,7 @@ func CountTokenInput(input any, model string, check bool) (int, error, bool) {
|
||||
func CountTokenStreamChoices(messages []dto.ChatCompletionsStreamResponseChoice, model string) int {
|
||||
tokens := 0
|
||||
for _, message := range messages {
|
||||
tkm, _, _ := CountTokenInput(message.Delta.Content, model, false)
|
||||
tkm, _, _ := CountTokenInput(message.Delta.GetContentString(), model, false)
|
||||
tokens += tkm
|
||||
if message.Delta.ToolCalls != nil {
|
||||
for _, tool := range message.Delta.ToolCalls {
|
||||
|
||||
Reference in New Issue
Block a user