jackMort / jackMort/ChatGPT.nvim

Warning when using `api_key_cmd`

Open
#443 3 comments 3 reactions 0 assignees View on GitHub
Dominant language
Lua
Stars
4k
Forks
317
PR merge metrics
No merged PRs in 30d

Description

I'm using the `op` option to set `api_key_cmd`. There are two issues I'm running in to, however.
1. Every time I open nvim, I get a warning that `OPENAI_API_KEY` is not set.
2. I'm immediately asked to authenticate with 1Password, even though I haven't loaded the plugin. I thought since `event = "VeryLazy"`, this should only load when I actually run chatgpt command.
I'm obviously doing something wrong, as no one else has posted about this issue. I'm just not sure what it is.

```lua
return {
"jackMort/ChatGPT.nvim",
event = "VeryLazy",
config = function()
require("chatgpt").setup({
api_key_cmd = "op read op://private/OpenAI/credential --no-newline",
api_model = "gpt-4-turbo",
})
end,
dependencies = {
"MunifTanjim/nui.nvim",
"nvim-lua/plenary.nvim",
"folke/trouble.nvim",
"nvim-telescope/telescope.nvim",
},
}
```
Screenshot 2024-06-07 at 3 06 35 PM

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the reported configuration with require("chatgpt").setup and the VeryLazy event, then trace what runs before a chatgpt command. Check when the OPENAI_API_KEY warning and 1Password authentication are triggered; done means neither occurs at startup and authentication happens only when the relevant command is used.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, neovim
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.