From d74a68ec3955ed67dae3ba37447831ac463c3626 Mon Sep 17 00:00:00 2001 From: Guilherme de Paula <3932327+guilhermep@users.noreply.github.com> Date: Sat, 10 Jun 2023 11:22:57 -0300 Subject: [PATCH] fix(main_no_modal.py): load environment variables from .env file --- main_no_modal.py | 4 ++++ requirements.txt | 1 + 2 files changed, 5 insertions(+) diff --git a/main_no_modal.py b/main_no_modal.py index b3edba516..55012149e 100644 --- a/main_no_modal.py +++ b/main_no_modal.py @@ -3,6 +3,7 @@ import ast from time import sleep from utils import clean_dir +from dotenv import load_dotenv from constants import DEFAULT_DIR, DEFAULT_MODEL, DEFAULT_MAX_TOKENS def generate_response(system_prompt, user_prompt, *args): @@ -104,6 +105,9 @@ def generate_file( def main(prompt, directory=DEFAULT_DIR, file=None): + # load .env file + load_dotenv() + # read file from prompt if it ends in a .md filetype if prompt.endswith(".md"): with open(prompt, "r") as promptfile: diff --git a/requirements.txt b/requirements.txt index fd9510f5d..bd6b50c61 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,4 @@ # if you are running the default variants (main.py, debugger.py, etc), you do not need to install these requirements openai tiktoken +python-dotenv \ No newline at end of file