mit-submit / A2rchi

An AI Augmented Research Chat Intelligence for MIT's subMIT project in the physics department
MIT License
9 stars 6 forks source link

Feature/add timeout to client requests #141

Closed mdr223 closed 1 year ago

mdr223 commented 1 year ago

This feature adds timeout functionality to the client and server-sides of our chat application. On the client side we timeout the request after a specified duration (default 120s). Once the timeout occurs, the client will display the "Oops!" error message.

We also need to handle request timeouts at the server. Simply timing out a request from the client does not stop the server from trying to process the request (and calling OpenAI), only to produce a result that will be in vain. Thus, right before we call the Chain, we check to see if the timeout has already occurred. If so, we return an error instead of executing the request.

I also made some minor changes to the front-end: