mirror of
https://github.com/coalaura/whiskr.git
synced 2025-12-02 20:22:52 +00:00
alive chunk
This commit is contained in:
14
chat.go
14
chat.go
@@ -9,6 +9,7 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/revrost/go-openrouter"
|
||||
)
|
||||
@@ -329,6 +330,19 @@ func HandleChat(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
debug("handling request")
|
||||
|
||||
go func() {
|
||||
ticker := time.NewTicker(10 * time.Second)
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
case <-ticker.C:
|
||||
response.WriteChunk(NewChunk(ChunkAlive, nil))
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
for iteration := range raw.Iterations {
|
||||
debug("iteration %d of %d", iteration+1, raw.Iterations)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user