OpenInterpreter / open-interpreter

A natural language interface for computers
http://openinterpreter.com/
GNU Affero General Public License v3.0
56.06k stars 4.85k forks source link

Replace ENTER with SHIFT-ENTER for sending a message to the llm. Use ENTER for new lines. #1502

Open Emasoft opened 1 month ago

Emasoft commented 1 month ago

Is your feature request related to a problem? Please describe.

Currently we cannot write code longer than one line or paste some code snippets without triggering the message to be sent one line at time. Replacing ENTER with SHIFT-ENTER solves the issue. It also make more difficult to send a message by accident.

Describe the solution you'd like

Replace ENTER with SHIFT-ENTER for sending a message to the llm. Use ENTER for new lines.

Describe alternatives you've considered

You can integrate in the terminal a multiline editor, like Textual. But this is a more complex solution.

Additional context

No response

QUAGZA commented 4 weeks ago

Wouldn't it be easier to just assign shift enter to new line? Which most applications conventionally do

Notnaton commented 4 weeks ago

Wouldn't it be easier to just assign shift enter to new line? Which most applications conventionally do

I agree with this Might implement this next week

Manamama commented 3 weeks ago

Yes, keep Enter as SEND, and e.g. Shift+Enter for newlines.

Emasoft commented 3 weeks ago

No, because if I PASTE a text with few lines of code, only the first one is sent, then it returns, leaving out all the remaining lines of code. This is why SHIFT+ENTER is the best choice to send.
ENTER should simply add a line break without sending.

Manamama commented 3 weeks ago

True. But:

  1. I resolve your situation with "Use cat to read file x.txt and act on it", with that file having whatever one wants, even hidden codes.
  2. Too onerous to press Shift+Enter each time; folks would abandon it due to user fatigue.
Emasoft commented 3 weeks ago

Let the thing be configurable. Users that find it onerous should only change a setting from true to false. And regarding the suggestion to use cat and read a file... are you joking? Are you really suggesting that we should create a text file, write the code in it, and call the cat to read it asking the llm to read the output, every time we need to paste a snippet from, for example, stackoverflow? I just need one command to paste while I’m writing, why instead I should go through all those steps? It is ridiculous. Are you trying to make everybody's life harder?

MikeBirdTech commented 3 weeks ago

@Emasoft no need for the harshness. All suggestions are welcome and everybody's workflow is different.

I like the idea of a configurable option and I'll raise it with the team. If you want to make a PR for it, I'd be happy to review it

QUAGZA commented 3 weeks ago

Customizable key binds are also a good idea, and speaking of reading from a file it might come in handy if you have to run a script frequently you can make Open Interpreter read it from a saved file. Also speaking of copy-pasting commands we can make it so that the given prompt doesn't execute as long as we don't hit enter.

KillianLucas commented 3 weeks ago

I think we can have a more clear alternative which suggests the user type """ to start a multiline prompt, inspired by Ollama:

Screenshot 2024-11-04 at 9 16 57 AM

This is super friendly to large code blocks being pasted:

Screenshot 2024-11-04 at 9 17 12 AM

Thoughts? This won't require any mucking about with input monitoring (I tried to get a shift enter functionality working, but kept running into that) and I think Ollama has proven that this is a popular approach.