1
0
mirror of https://github.com/coalaura/whiskr.git synced 2025-12-02 20:22:52 +00:00

alive chunk

This commit is contained in:
2025-11-03 03:32:19 +01:00
parent 85ed078058
commit 41210d0b36
3 changed files with 20 additions and 0 deletions

14
chat.go
View File

@@ -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)