Skip to content
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

🐛 [Streaming Chat] Improve error handling on bad chat request messages #272

Open
roma-glushko opened this issue Jun 13, 2024 · 0 comments
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

Comments

@roma-glushko
Copy link
Member

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:
Screenshot 2024-06-13 at 22 40 16

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.

@roma-glushko roma-glushko added type:bug Something isn't working as expected good first issue Good for newcomers help wanted Extra attention is needed api:http area:api size:small model:language labels Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

1 participant