Skip to content

Commit

Permalink
add streamimg finish reason check
Browse files Browse the repository at this point in the history
  • Loading branch information
devinyf committed Mar 8, 2024
1 parent f41ee85 commit 1b2c5d2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion qwen/qwencli.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ func iterateStreamChannel[T IQwenContent](ctx context.Context, channel <-chan St
choice.FinishReason = rspData.Output.Output.Choices[0].FinishReason

outputMessage.Output.Choices[0] = choice

if choice.FinishReason != "" && choice.FinishReason != "null" {
break
}
}
}

Expand All @@ -101,7 +105,7 @@ func asyncChatStreaming[T IQwenContent](
cli httpclient.IHttpClient,
url, token string,
) <-chan StreamOutput[T] {
chanBuffer := 100
chanBuffer := 1000
_respChunkChannel := make(chan StreamOutput[T], chanBuffer)

go func() {
Expand Down

0 comments on commit 1b2c5d2

Please sign in to comment.