Robitx/gp.nvim

attempt to index a nil value

joshmedeski opened this issue · 1 comments

Hey, I'm getting the following error when trying to run a custom hook.

Error executing vim.schedule lua callback: ....local/share/kickstart-nvim/lazy/gp.nvim/lua/gp/init.lua:1426: attempt to index a
nil value

stack traceback:

        ....local/share/kickstart-nvim/lazy/gp.nvim/lua/gp/init.lua:1426: in function 'query'
        ....local/share/kickstart-nvim/lazy/gp.nvim/lua/gp/init.lua:3143: in function 'callback'
        ....local/share/kickstart-nvim/lazy/gp.nvim/lua/gp/init.lua:3164: in function <....local/share/kickstart-nvim/lazy/gp.nv
im/lua/gp/init.lua:3155>

It appears to be this line that isn't able to grab a provider.

I disabled all my custom configuration and just used the hook sample from the README

        UnitTests = function(gp, params)
          local template = "I have the following code from {{filename}}:\n\n"
            .. "```{{filetype}}\n{{selection}}\n```\n\n"
            .. "Please respond by writing table driven unit tests for the code above."
          local agent = gp.get_command_agent()
          gp.Prompt(params, gp.Target.enew, nil, agent.model, template, agent.system_prompt)
        end,

I'm not sure if it's related to the new providers feature, but I tested with a few agents selected and couldn't figure it out. Thanks for the help!

Thanks for the quick fix! 👏