diff --git a/setup.py b/setup.py index e4c63e5..a23a7de 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ def read_requirements(): setup( name='gptdeploy', - version='0.18.14', + version='0.18.15', description='Use natural language interface to create, deploy and update your microservice infrastructure.', long_description=open('README.md', 'r', encoding='utf-8').read(), long_description_content_type='text/markdown', diff --git a/src/__init__.py b/src/__init__.py index 1fbea55..8b59a8a 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -1,2 +1,2 @@ -__version__ = '0.18.14' +__version__ = '0.18.15' from src.cli import main \ No newline at end of file diff --git a/src/gpt.py b/src/gpt.py index ca5c26c..4dd10c0 100644 --- a/src/gpt.py +++ b/src/gpt.py @@ -28,7 +28,11 @@ class GPTSession: def get_openai_api_key(self): if 'OPENAI_API_KEY' not in os.environ: - raise Exception('You need to set OPENAI_API_KEY in your environment') + raise Exception(''' +You need to set OPENAI_API_KEY in your environment. +If you have updated it already, please restart your terminal. +''' +) openai.api_key = os.environ['OPENAI_API_KEY'] def is_gpt4_available(self): diff --git a/src/key_handling.py b/src/key_handling.py index 999432c..53ae19a 100644 --- a/src/key_handling.py +++ b/src/key_handling.py @@ -80,8 +80,12 @@ def set_env_variable(shell, key): with open(config_file, "a") as file: file.write(f"\n{export_line}\n") - click.echo( - f"✅ Success, OPENAI_API_KEY has been set in {config_file}\nPlease restart your shell to apply the changes.") + click.echo(f''' +✅ Success, OPENAI_API_KEY has been set in {config_file}. +Please restart your shell to apply the changes or run: +source {config_file} +''' + ) except FileNotFoundError: click.echo(f"Error: {config_file} not found. Please set the environment variable manually.") @@ -93,7 +97,12 @@ def set_api_key(key): if system_platform == "windows": set_env_variable_command = f'setx OPENAI_API_KEY "{key}"' subprocess.call(set_env_variable_command, shell=True) - click.echo("✅ Success, OPENAI_API_KEY has been set.\nPlease restart your Command Prompt to apply the changes.") + click.echo(''' +✅ Success, OPENAI_API_KEY has been set. +Please restart your Command Prompt to apply the changes. +''' + ) + elif system_platform in ["linux", "darwin"]: if "OPENAI_API_KEY" in os.environ or is_key_set_in_config_file(key): if not click.confirm("OPENAI_API_KEY is already set. Do you want to overwrite it?"):