jackMort/ChatGPT.nvim

1Password prompts for password everytime

Opened this issue · 2 comments

Ok, so 1password-cli doesn't seem to like whatever it is we do when we invoke it through api_key_cmd on Arch. It prompts for authorization everytime.

I can op read from that same terminal multiple times and only prompting the first time, however whenever I launch nvim it prompts.

It might be related to plenary.job and the fact that 1Password seems to use the TTY to remember sessions:

37069 ?        Sl     0:00 op read op://Private/openai-api-key/password

vs (when running from shell):

37425 pts/1    Sl+    0:00 op read op://Private/openai-api-key/password

https://developer.1password.com/docs/cli/app-integration-security/#session-credentials

Having the same issue.

Kitty 0.23.1
Fish 3.7.0
MacOS 14.6.1

this works for me on macos: https://github.com/loteoo/ks

api_key_cmd = "ks show openai",

it prompts when the plugin is loaded the first time.

one question I have (maybe related feature request?) can we wait to ask for the key until the first time we use a command? it is a little annoying to type in the prompt every time I open nvim before I use chat gpt

EDIT: we can actually delay the plugin loading with lazyvim cmd:

  {
    "jackMort/ChatGPT.nvim",
    dependencies = {
      { "MunifTanjim/nui.nvim" },
      { "nvim-lua/plenary.nvim" },
      { "nvim-telescope/telescope.nvim" },
    },
    cmd = { "ChatGPT", "ChatGPTActAs", "ChatGPTRun", "ChatGPTEditWithInstructions" },
    config = function()
      require("chatgpt").setup {
        api_key_cmd = "ks show openai",

this will delay the prompt until one of the cmd is used