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:
6
chat.go
6
chat.go
@@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user