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

openai_api_key command gpg fails #124

Closed Awallace3 closed 3 months ago

Awallace3 commented 3 months ago

I have been really liking Robitx/gp.nvim over jackMort/ChatGPT.nvim because it is exactly what I want. However, the only issue is that the openai_api_key command does not seem to be about to use gpg to decrypt a file. Upon startup, I receive the following message on:

 Gp: config.openai_api_key command { "gpg", "--decrypt ", "/path/to/secret.txt.gpg" } to retrieve openai_api_key failed:
code: 2, signal: 0
stdout: 
stderr: invalid option "--decrypt "
Press ENTER or type command to continue

What is the underlying call here that prevents the command from running correctly? I tried passing all values in as a single string as well to no avail (I get an unresolved command error when trying to get a response). Any ideas on how to make this command call compatible with flags like decrypt for using GNU gpg? I have provided versions below:

cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.2 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
gpg (GnuPG) 2.2.27
libgcrypt 1.9.4
Copyright (C) 2021 Free Software Foundation, Inc.
License GNU GPL-3.0-or-later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: /theoryfs2/ds/amwalla3/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
        CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2
nvim --version
NVIM v0.9.2-dev-54+g953904c00
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Robitx commented 3 months ago

@Awallace3 the space after decrypt seems wierd "--decrypt " please try it without => "--decrypt".

Awallace3 commented 3 months ago

You are right. Removing that space fixed the issue, and I should have seen that myself. Thank you for your patience.