isgrove / chat.nvim

Add AI completion features to Neovim (like ChatGPT or Github Copilot)
MIT License
6 stars 0 forks source link

commentary and code are written in incorrect format on the current buffer #1

Closed Vinni-Cedraz closed 5 months ago

Vinni-Cedraz commented 5 months ago

First of all: congrats on the initiative of making an LLM plugin for neovim that incorporates the groq-api with llama. There are countless possibilities for this! And it can be the best copilot alternative (maybe even better for some cases) for those who do not have money for it. Then, the issue: If we're going with the option of interacting with the bot directly from the text file instead of opening a new window somewhere, then it should be written with proper formatting:

image

We cannot write to a source file of a programming language (like .c, .lua, .javascript, etc.) with plain text like that... it should at least be commented out with //

image

There's also the issue with ```c which is correct for Discord and some other platforms but makes no sense in a .c file.

Vinni-Cedraz commented 5 months ago

I found out that prompting the bot again with "filter out from your answer everything that is not code, including the formatting backticks ```" is effective to make it output pure code in the second iteration. We could filter out the bot response with this second prompt before outputting the final response to the user.

isgrove commented 5 months ago

Thank you for the kind words, Vinni! My goal was to make it cheaper to alternate between APIs by only paying for what you use via the API, instead of having subscriptions to ChatGPT, Claude, Gemini, etc. Alternatively, you can use the Groq API, which is currently free (though I suspect this might change).

In my usage, I have been manually deleting the markdown-style backticks. After testing your suggestion of appending "Filter out from your answer everything that is not code, including the formatting backticks ``" to the system prompt in theREADME.md, I found that it produces a more suitable generation. Thank you! I have updated theREADME.md` accordingly.

As mentioned in the README.md, I want to add support to easily toggle between system prompts and add support for other APIs. I can see many use cases for this.

Once again, thank you for your feedback and help. If you notice any other bugs or have any feature suggestions, please let me know!