jackMort / ChatGPT.nvim

ChatGPT Neovim Plugin: Effortless Natural Language Generation with OpenAI's ChatGPT API
Apache License 2.0
3.67k stars 311 forks source link

[feature request]: ChatGPTActAs allows user to edit prompt before submitting #182

Closed rensftw closed 1 year ago

rensftw commented 1 year ago

ChatGPTActAs is a very powerful command and it would be even better if the user could edit the Awesome Prompt text before the request gets submitted.

Current behaviour ChatGPTActAs shows a preview and title for awesome prompts, but does not allow prompt to be yanked. I have tried <C-w w>, but this causes the prompt to close instead of letting me navigate to the prompt preview window and yank the prompt (see video below 👇) .

https://user-images.githubusercontent.com/22574186/236442926-9d1f104a-c2e2-4312-904f-d822affadc32.mp4

Once you choose a prompt it is immediately submitted to the OpenAI endpoint and consumes tokens, even if the prompt is not customized/ready to be submitted yet.

Proposed behaviour ChatGPTActAs shows a preview and title for awesome prompts; hitting enter (or some other keybinding) opens a new session and populates the prompt field so it can be modified by the user before submitting.

image

PS: Thank you for the great plugin! ❤️ It's my favourite way of interfacing with ChatGPT

jackMort commented 1 year ago

I added option to set "system message" it should solve the issue, need to update the README later to cover that.

rensftw commented 1 year ago

Thanks for the fast response ⚡

I tested it out and the new SYSTEM window looks really good! My first instinct was to jk for moving but I realised that the prompt is one single wrapped line.

https://user-images.githubusercontent.com/22574186/236673735-d14d1e5b-f58a-48c5-ba35-aad4447668bb.mp4

@jackMort Btw, how should draft_message = "<C-d>" be used? In ChatGPTActAs it just scrolls the preview buffer (usual Vim movement) In the regular prompt it seems to send an empty message and nothing else?

EDIT: I remapped draft_message to <C-m> so there's no clash with the scrolling keymap, but it still does nothing in chat mode 🤷‍♀️

https://user-images.githubusercontent.com/22574186/236674040-f81995cb-4eba-41a2-9965-a63330037dec.mp4

rensftw commented 1 year ago

Closing this issue because my initial request is already live 🙏