kardolus / chatgpt-cli

ChatGPT CLI is a versatile tool for interacting with ChatGPT models via OpenAI and Azure, as well as with models from Perplexity AI. It offers streaming, query mode, and history tracking for seamless, context-aware interactions. With extensive configuration options, it’s designed for both users and developers to create a tailored GPT experience.
MIT License
454 stars 32 forks source link

New Line in interactive mode #59

Closed mandulaj closed 1 month ago

mandulaj commented 1 month ago

Love this tool! Is there a way though to write the prompts across multiple lines into the interactive mode. I tried Shift-Enter Ctrl-Enter but all of them submit the prompt....

kardolus commented 1 month ago

@mandulaj This is a good point! It's not supported. I will look into it.

kardolus commented 1 month ago

I played around with the current library: github.com/chzyer/readline

But unfortunately it cannot detect SHIFT. I would have to write my own low level input handling which would not be portable across platforms or even shells within the same platform (eg zsh vs bash on a Mac).

Will try to come up with something. I really like the idea, but I am sceptic that I can come up with a solution anytime soon.

kardolus commented 1 month ago

This has been very interesting. I learned a lot about how the keyboard works. Apparently my mac keyboard doesn't send "shift+" to my Go program. It just sends the combined output. Ie. it does not send "shift+a", it sends "A".

Long story short, I don't know how to implement this :/.