Skip to content

Commit

Permalink
Close channels for the stream from string helper (#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
crspeller authored Nov 18, 2024
1 parent 4f033ef commit e57c29e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server/ai/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ type TextStreamResult struct {

func NewStreamFromString(text string) *TextStreamResult {
output := make(chan string)
err := make(chan error)

go func() {
output <- text
close(output)
close(err)
}()

return &TextStreamResult{
Stream: output,
Err: err,
}
}

Expand Down

0 comments on commit e57c29e

Please sign in to comment.