File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -188,8 +188,9 @@ def write_config_file(config_data):
188188 console .print (f"✅ Created config file at { config_file } " )
189189
190190 is_terminal = sys .stdout .isatty ()
191+ openai_api_key = openai_api_key or config_data ["openai_api_key" ] or os .getenv ("OPENAI_API_KEY" )
191192 if not is_terminal :
192- if config_data [ " openai_api_key" ] is None :
193+ if openai_api_key is None :
193194 raise click .ClickException (
194195 "🛑 No OpenAI API key found.\n "
195196 "Please set the OPENAI_API_KEY environment variable or call configure with --openai-api-key set."
@@ -437,7 +438,7 @@ def setup_config():
437438 existing_config = read_config ()
438439 if not existing_config :
439440 console .print ("Welcome to AI Code Bot! 🤖. Let's set up your config file.\n " , style = bot_style )
440- configure .callback (openai_api_key = None , verbose = 0 )
441+ configure .callback (openai_api_key = os . getenv ( "OPENAI_API_KEY" ) , verbose = 0 )
441442 sys .exit ()
442443 else :
443444 return existing_config
You can’t perform that action at this time.
0 commit comments