Robitx / gp.nvim

Gp.nvim (GPT prompt) Neovim AI plugin: ChatGPT sessions & Instructable text/code operations & Speech to text [OpenAI, Ollama, Anthropic, ..]
MIT License
784 stars 67 forks source link

Preprocess user messages #107

Open helins opened 7 months ago

helins commented 7 months ago

A custom hook on every user message before sending the chat for completion would make this plugin extremely extensible. For instance, a hook might rewrite messages so that a substring like [[file x]] would embed the actual file x. That would open a world of possibilities.

Of course, right know anyone could use some Neovim magic to actually embed the data directly in the chat using commands and such. However, that would often bloat the buffer (e.g. sending a large file) and generally speaking be a limiting factor.

qaptoR commented 2 months ago

I desire this feature as well. I will work on a PR in the coming week or so.

If anyone has an preference or suggestion for what the preprocessor syntax ought to look like, leave them in a comment. There was a plugin for obsidian that had this feature available, and so I will try to make the PR on parity with it.