open-interpreter icon indicating copy to clipboard operation
open-interpreter copied to clipboard

Extra keypresses between calls not being visibly captured

Open rustom opened this issue 2 years ago • 1 comments

Describe the bug

In between calls (pressing "enter"), if a user makes any keypresses, they are sometimes not visibly captured and cannot be deleted before the next input. This can contaminate the input to the next call, particularly in the case of "Would you like to run this code? (y/n)".

One situation in which this is prone to happening is when users get key-happy due to API lag. For example, if a user types a prompt and presses enter, but doesn't see any result for a second, they might press enter again to "confirm" their input for good measure. Then, when the initial response has finished and OI prompts for (y/n), the "y" that the user types will be precluded from the response because the input has already been completed by pressing enter.

Reproduce

  1. Enter a prompt in terminal interface
  2. While the response is being generated press enter and/or type some words
  3. When prompted for "Would you like to run this code? (y/n)", enter "y"
  4. The system will interpret this as a default or an "n"

Expected behavior

I would imagine one of two ways of handling this:

  1. All keypresses that occur before the model has finished printing its output should be ignored
  2. All keypresses should be considered temporary input (including "enter") and should be able to be edited/deleted before finishing next input

I think the first option is safer and more understandable. Happy to make a PR to address this, let me know if there is disagreement.

Screenshots

Screenshot 2024-04-04 at 12 30 06 AM

Open Interpreter version

0.2.4

Python version

3.9.13

Operating System name and version

MacOS Sonoma 14.2.1

Additional context

No response

rustom avatar Apr 04 '24 07:04 rustom

@tyfiero @KillianLucas Do you have thoughts on this one?

MikeBirdTech avatar Apr 09 '24 15:04 MikeBirdTech