install.bat and fix error caused with api key

This commit is contained in:
KAuser2094
2023-03-06 16:08:28 +00:00
parent 9805412c55
commit e75925c3f2
5 changed files with 24 additions and 7 deletions
+3 -2
View File
@@ -82,10 +82,11 @@ if __name__ == "__main__":
# Two options for the user to specify they openai api key. Windows: Comment out the one you are not using (Causes extra line to appear)
home_path = os.path.expanduser("~")
openai.api_key_path = os.path.join(home_path,".openai.apikey")
dotenv.load_dotenv()
openai.api_key = os.getenv("OPENAI_API_KEY")
if not openai.api_key:
home_path = os.path.expanduser("~")
openai.api_key_path = os.path.join(home_path,".openai.apikey")
# Parse arguments and make sure we have at least a single word
if len(sys.argv) < 2: