dustinblackman/oatmeal

Feature request: Hotkeys to control response stream

dxrcy opened this issue · 6 comments

Hi, this is a really neat project.
I was wondering if it would be possible to add hotkeys to control the model's responses (similar to ChatGPT).

Example:

  • Ctrl+C to stop the incoming response
  • Ctrl+R to repeat the previous prompt

Or if there is a better way to handle this?

Thanks :)

I realize that Ctrl+C is used to quit, so keybind would need to be used obviously.

Hey @darccyy

Both are solid ideas! I appreciate the PR to get CTRL+R in there.

Hotkey bindings are doable, but then I get the complexity of introducing config files, and managing them across different OS'. I don't think I'm there yet, we can solve this through the existing experience.

Thinking about it a bit, it could be simpler to do CTRL C if waiting_for_backend then CANCEL else EXIT_APP so that if waiting for the backend and you wanna exit, you get CTRL C twice. I think that feels a bit more natural.

I can picture how to put this together, I'll just have refactor how I listen for a events first, which I had intended to do for other reasons anyway. :)

I'm not a big ChatGPT user, is there other hotkeys that should be considered?

I don't actually think the ChatGPT web app has hotkeys, but it has action buttons to regenerate or copy the response (as well as rate positive or negative).
The ollama CLI uses Ctrl+C to stop response, and Ctrl+D or /bye to quit. (It also shows a prompt to press Ctrl+D if you try to quit with Ctrl+C)

Other potential hotkeys could be:

  • Copy the entire response, or specific codeblocks (like the /copy command)
  • Clear history (start new session)

I like the idea of Ctrl+C to stop OR quit, depending on state, but this might be annoying if the program is accidently exited, if history is not preserved. But I'm not sure, what do you think?

I can try to make a PR for cross-platform keybinding config if you think it's within the project scope :)

I can try to make a PR for cross-platform keybinding config if you think it's within the project scope :)

It's not that I don't like the idea, it's more that I'd rather only introduce config files if the feature set of the app hit a complexity that we'd need it (such as getting to the silly point of trying to stick JSON in envs or command line parameters :P). I've felt the pains of trying to do backwards compatibility for config files, I'd like to see how the app evolves first. :)

I like the idea of Ctrl+C to stop OR quit, depending on state, but this might be annoying if the program is accidently exited, if history is not preserved. But I'm not sure, what do you think?

That's a good point. A history file isn't on my TODOs yet either, though I'd be open to it as a feature. As CTRL+D is used for page down to follow what Vim uses, I think I'll take a page out of NodeJS' book and add a final confirmation before closing. If it really becomes a problem, maybe removing CTRL C for exiting. I'll sleep on it. :)

I think I'll take a page out of NodeJS' book and add a final confirmation before closing.

That sounds good.

Fixed in v0.3.0. Thanks!