-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
chore: stream errors while streaming SSE #6160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
✅ Deploy Preview for localai ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
} | ||
var buf bytes.Buffer | ||
enc := json.NewEncoder(&buf) | ||
enc.Encode(ev) |
Check warning
Code scanning / gosec
Errors unhandled Warning
log.Debug().Msgf("Sending chunk failed: %v", err) | ||
input.Cancel() | ||
} | ||
w.Flush() |
Check warning
Code scanning / gosec
Errors unhandled Warning
} | ||
respData, _ := json.Marshal(resp) | ||
|
||
w.WriteString(fmt.Sprintf("data: %s\n\n", respData)) |
Check warning
Code scanning / gosec
Errors unhandled Warning
respData, _ := json.Marshal(resp) | ||
|
||
w.WriteString(fmt.Sprintf("data: %s\n\n", respData)) | ||
w.WriteString("data: [DONE]\n\n") |
Check warning
Code scanning / gosec
Errors unhandled Warning
|
||
w.WriteString(fmt.Sprintf("data: %s\n\n", respData)) | ||
w.WriteString("data: [DONE]\n\n") | ||
w.Flush() |
Check warning
Code scanning / gosec
Errors unhandled Warning
} | ||
var buf bytes.Buffer | ||
enc := json.NewEncoder(&buf) | ||
enc.Encode(ev) |
Check warning
Code scanning / gosec
Errors unhandled Warning
|
||
log.Debug().Msgf("Sending chunk: %s", buf.String()) | ||
fmt.Fprintf(w, "data: %v\n", buf.String()) | ||
w.Flush() |
Check warning
Code scanning / gosec
Errors unhandled Warning
} | ||
log.Error().Msgf("Stream ended with error: %v", err) | ||
fmt.Fprintf(w, "data: %v\n", "Internal error: "+err.Error()) | ||
w.Flush() |
Check warning
Code scanning / gosec
Errors unhandled Warning
Description
Otherwise these are silently absorbed in the background
Notes for Reviewers
Signed commits