Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when opening nvim through a script that spawns a term with nvim with a set working dir, it cannot use the OPENAI_API_KEY envir variable. #53

Open
emilBeBri opened this issue Oct 13, 2023 · 0 comments

Comments

@emilBeBri
Copy link

Hi, so I have a script that opens nvim in different working dirs based on keyboard shortcuts.

This would be the command that gets executed:


alacritty --working-directory /home/emil/test --title 'nv-configtest' -e $EDITOR

However, when doing this, I get this very clear message telling me the API key is not present as an environmental variable:

OPENAI_API_KEY environment variable is not set, and open_api_key.value is empty
E5108: Error executing lua ...l/.local/share/nvim/lazy/neoai.nvim/lua/neoai/config.lua:72: OPENAI_API_KEY environment variable is not set, and open_api_key.valu
e is empty

WHat I don't get is that this variable has been set - and I know this, because when I spawn a terminal, fx with a keyboard shortcut in i3:


bindsym $mod+Shift+l exec alacritty; mode "default"


I can see that the variable is there with echo $OPENAI_API_KEY. if I open nvim manually, from such a spawned terminal, NeoAI works fine because the envir var is there. But when doing it through my script, there is nothing.

I have tried putting the



export OPENAI_API_KEY=xxxxxxxxxxxxxxxx

in both ~/.profile and ~/.bashrc, to no avail.

I suspect this is a problem not of neoAI but of my lack of knowledge about how launching a terminal from within a script does not trigger the use of the bash profile, but I'm not sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant