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
View File
+20
View File
@@ -0,0 +1,20 @@
@echo off
:: Installs yolo in the user's home directory
::TARGET_DIR=~/yolo-ai-cmdbot
::TARGET_FULLPATH=$TARGET_DIR/yolo.py
set TARGET_DIR= %HOME%yolo-ai-cmdbot
set TARGET_FULLPATH= %TARGET_DIR%\yolo.py
::mkdir -p $TARGET_DIR
::cp yolo.py prompt.txt $TARGET_DIR
::chmod +x $TARGET_FULLPATH
mkdir %TARGET_DIR%
copy yolo.py %TARGET_DIR%
copy prompt.txt %TARGET_DIR%
:: Windows: Copies .bat file to $HOME so it works similar to LINUX/MAC, avoiding having to type python.exe every time.
:: Note: Though that maybe making it an executable would make more sense but the
::Copy to home directory
copy yolo.bat %HOME%
-4
View File
@@ -16,7 +16,3 @@ alias computer=$TARGET_FULLPATH
# Add the aliases to the logon scripts # Add the aliases to the logon scripts
echo "alias yolo=$TARGET_FULLPATH" >> ~/.bash_aliases echo "alias yolo=$TARGET_FULLPATH" >> ~/.bash_aliases
echo "alias computer=$TARGET_FULLPATH" >> ~/.bash_aliases echo "alias computer=$TARGET_FULLPATH" >> ~/.bash_aliases
# Windows
# Copy yolo.bat to System32 or Home Directory :
cp yolo.bat ~
+1 -1
View File
@@ -1,6 +1,6 @@
@echo off @echo off
REM Work around to not have to type in python.exe yolo.py every time. REM Work around to not have to type in python.exe yolo.py every time.
REM Put in C:/Windows/System32 to allow command to work anywhere REM Put in C:/Windows/System32 or another $PATH directory to allow command to work anywhere
python.exe yolo-ai-cmdbot/yolo.py %* python.exe yolo-ai-cmdbot/yolo.py %*
+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) # 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() dotenv.load_dotenv()
openai.api_key = os.getenv("OPENAI_API_KEY") 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 # Parse arguments and make sure we have at least a single word
if len(sys.argv) < 2: if len(sys.argv) < 2: