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:
|
if err = c.ReadJSON(&chatRequest); err != nil { |
|
// TODO: handle bad request schemas gracefully and return back validation errors |
|
if websocket.IsUnexpectedCloseError(err, websocket.CloseNormalClosure, websocket.CloseGoingAway) { |
|
tel.L().Warn("Streaming Chat connection is closed", zap.Error(err), zap.String("routerID", routerID)) |
|
} |
|
|
|
tel.L().Debug("Streaming chat connection is closed by client", zap.Error(err), zap.String("routerID", routerID)) |
|
|
|
break |
|
} |
For example, you can open a streaming chat connection (via Postman, for example):
{{base_url}}/language/{{routerID}}/chatStream
Then, send it just an empty message like:
You would get an error like:

Finally, if you try to send a valid message now:
"message": {
"role": "user",
"content": "Write an essay about ecommerce in a modern era"
}
It would not really work.
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:

Finally, if you try to send a valid message now:
It would not really work.