🐛 [Streaming Chat] Improve error handling on bad chat request messages #272
Labels
api:http
area:api
good first issue
Good for newcomers
help wanted
Extra attention is needed
model:language
size:small
type:bug
Something isn't working as expected
A Glide's streaming channel gets closed on chat requests that doesn't pass validation.
The issue is in the way we handle errors right now:
glide/pkg/api/http/handlers.go
Lines 139 to 148 in bca8c8f
For example, you can open a streaming chat connection (via Postman, for example):
Then, send it just an empty message like:
You would get an error like:
![Screenshot 2024-06-13 at 22 40 16](https://private-user-images.githubusercontent.com/9402690/339530473-f1d54d6a-110d-42be-9114-acc3c6db6d9b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxMTc5MjEsIm5iZiI6MTczOTExNzYyMSwicGF0aCI6Ii85NDAyNjkwLzMzOTUzMDQ3My1mMWQ1NGQ2YS0xMTBkLTQyYmUtOTExNC1hY2MzYzZkYjZkOWIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDlUMTYxMzQxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YjQyMDVhODc0YWNkODk5MTg2ZTFmOGQ4Y2VhNjcxMjA2OTc3ZTEzYjBkNjhmY2U3MmU0M2QzM2ViMDg3Y2UwZSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.tEKmGOYtKiHs-D_H9IC1BIR6J_yZEFRtlPtaxz-jFDQ)
Finally, if you try to send a valid message now:
It would not really work.
The text was updated successfully, but these errors were encountered: