Robitx / gp.nvim

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

customize default chat tempalte #135

Open ucl98 opened 1 month ago

ucl98 commented 1 month ago

Hi, Is it possible to customize the template of the default chat? I found that the default message with instructions is defined via chat_template but I failed to find a solution how I can customize the message. I would prefer to have it removed if possible.

argshook commented 1 month ago

Hey there! I submitted a PR which allows to customize chat_template here: https://github.com/Robitx/gp.nvim/pull/117

but it's not merged to this repo and so far is only available in my fork. Give it a spin if you'd like.

I use neovim with lazy plugin manager, and configure gp.nvim like this:

require("lazy").setup({
  {
    "argshook/gp.nvim",
        config = function()
          require("gp").setup({
            chat_template = "# topic: ?\n\n"
              .. "- file: %s\n"
              .. "---\n"
              .. "🗨: "
          })
        end
  }
})

you might not want to remove the default message entirely. I find it useful to include at least the chat_user_prefix symbol:

require("lazy").setup({
  {
    "argshook/gp.nvim",
        config = function()
          require("gp").setup({
            chat_template = "🗨: "
          })
        end
  }
})

Disclaimer: i don't really maintain my fork too much, just have few tweaks for my own needs!

ucl98 commented 1 month ago

Thanks for your contribution. It's the feature I was hoping for :)