Skip to content

Commit

Permalink
Prevent sending an input until the previous response has been handled
Browse files Browse the repository at this point in the history
This would ideally use a queue but that will require using a different UI since the gradio ChatBot expects each input to return a value synchronously
Relates to #26
  • Loading branch information
NeonDaniel committed Nov 7, 2023
1 parent 1f13ed1 commit 4144a8b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions neon_iris/web_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

from asyncio import Queue
from os import makedirs
from os.path import isfile, join, isdir
from time import time
Expand Down Expand Up @@ -128,7 +128,9 @@ def on_user_input(self, utterance: str, *args, **kwargs) -> str:
@param utterance: String utterance submitted by the user
@returns: String response from Neon (or "ERROR")
"""
# TODO: This should probably queue with a separate iterator thread
LOG.debug(f"Input received")
if not self._await_response.wait(30):
LOG.error("Previous response not completed after 30 seconds")
LOG.debug(f"args={args}|kwargs={kwargs}")
self._await_response.clear()
self._response = None
Expand Down

0 comments on commit 4144a8b

Please sign in to comment.