1
0
mirror of https://github.com/coalaura/whiskr.git synced 2025-09-09 09:19:54 +00:00

harden response streaming

This commit is contained in:
2025-08-29 19:26:55 +02:00
parent 58aa250abe
commit 3d629c93c5
2 changed files with 53 additions and 25 deletions

View File

@@ -256,7 +256,9 @@ func HandleChat(w http.ResponseWriter, r *http.Request) {
debug("preparing stream")
response, err := NewStream(w)
ctx := r.Context()
response, err := NewStream(w, ctx)
if err != nil {
RespondJson(w, http.StatusBadRequest, map[string]any{
"error": err.Error(),
@@ -267,8 +269,6 @@ func HandleChat(w http.ResponseWriter, r *http.Request) {
debug("handling request")
ctx := r.Context()
for iteration := range raw.Iterations {
debug("iteration %d of %d", iteration+1, raw.Iterations)