Browse Source

Merge remote-tracking branch 'origin/alpha' into alpha

t0ng7u 5 months ago
parent
commit
cda4790219
1 changed files with 4 additions and 1 deletions
  1. 4 1
      relay/channel/openai/helper.go

+ 4 - 1
relay/channel/openai/helper.go

@@ -3,6 +3,7 @@ package openai
 import (
 	"encoding/json"
 	"errors"
+	"github.com/samber/lo"
 	"net/http"
 	"one-api/common"
 	"one-api/dto"
@@ -186,7 +187,9 @@ func handleLastResponse(lastStreamData string, responseId *string, createAt *int
 		*containStreamUsage = true
 		*usage = lastStreamResponse.Usage
 		if !info.ShouldIncludeUsage {
-			*shouldSendLastResp = false
+			*shouldSendLastResp = lo.SomeBy(lastStreamResponse.Choices, func(choice dto.ChatCompletionsStreamResponseChoice) bool {
+				return choice.Delta.GetContentString() != "" || choice.Delta.GetReasoningContent() != ""
+			})
 		}
 	}