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

Multi-line input support. #1048

Merged
merged 2 commits into from
Mar 5, 2024

Conversation

Steve235lab
Copy link
Contributor

@Steve235lab Steve235lab commented Mar 1, 2024

Describe the changes you have made:

Support multi-line input by defining the function cli_input, which detects special combo (start_marker) in user's input like ``` to await more input until get an another special combo (end_marker). In this way, users can input multiple lines at one single input, which is very helpful when the users try to chat about pieces of code copied from their text editors. To enable this new feature, you can use interpreter --multi_line or interpreter -ml to launch OI, or you can simply set multi_line: True in your profile.

Although this new feature is ready to go for most cases, there's still some improvements can be done:

  1. If the multi-line part contains the end_marker string, it will cause an unexpected ending of the current input, which means you can't have ``` contained in your multi-line inputs.
  2. This new feature can be mis-triggered and get users trapped in the multi-line input loop. (This one is not a problem for now because this new feature is disabled by default in args.)

Here's an example, the first conversation was launched with this new feature disabled by default, and the second one was launched with this new feature enabled:
截屏2024-03-02 01 26 50

Reference any relevant issues (e.g. "Fixes #000"):

#1046

Pre-Submission Checklist (optional but appreciated):

  • I have included relevant documentation updates (stored in /docs)
  • I have read docs/CONTRIBUTING.md
  • I have read docs/ROADMAP.md

OS Tests (optional but appreciated):

  • Tested on Windows
  • Tested on MacOS
  • Tested on Linux

@Steve235lab
Copy link
Contributor Author

With the help of @ShadowDog from our Discord channel, we have tested this on Windows and local models.

@KillianLucas KillianLucas merged commit 6e64605 into OpenInterpreter:main Mar 5, 2024
0 of 2 checks passed
@KillianLucas
Copy link
Collaborator

@Steve235lab, you king. You scholar. Same to you @ShadowDog for testing!

This is literally one of the most highly requested features in OI— so much nicer to use! And I think we can pretty quickly push this as the default mode once we're sure it's stable.

I wonder if we can detect when the user is pasting something in, and just enable this immediately until the paste is complete somehow? Maybe we could turn on input() for like 100ms after a newline happens, so that if someone pastes something in, it's under the cutoff and the whole thing gets sent in. But if they hit enter normally, they just experience a 100ms delay.

@Steve235lab
Copy link
Contributor Author

I wonder if we can detect when the user is pasting something in, and just enable this immediately until the paste is complete somehow? Maybe we could turn on input() for like 100ms after a newline happens, so that if someone pastes something in, it's under the cutoff and the whole thing gets sent in. But if they hit enter normally, they just experience a 100ms delay.

Great idea, I'll implement this later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants