mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-17 05:33:42 +08:00
🐛 fix: Tokens may not be counted in the stream below
This commit is contained in:
@@ -376,3 +376,11 @@ type ChatCompletionStreamResponse struct {
|
||||
PromptAnnotations any `json:"prompt_annotations,omitempty"`
|
||||
Usage *Usage `json:"usage,omitempty"`
|
||||
}
|
||||
|
||||
func (c *ChatCompletionStreamResponse) GetResponseText() (responseText string) {
|
||||
for _, choice := range c.Choices {
|
||||
responseText += choice.Delta.Content
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user