install.bat and fix error caused with api key
This commit is contained in:
+20
@@ -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%
|
||||
@@ -16,7 +16,3 @@ alias computer=$TARGET_FULLPATH
|
||||
# Add the aliases to the logon scripts
|
||||
echo "alias yolo=$TARGET_FULLPATH" >> ~/.bash_aliases
|
||||
echo "alias computer=$TARGET_FULLPATH" >> ~/.bash_aliases
|
||||
|
||||
# Windows
|
||||
# Copy yolo.bat to System32 or Home Directory :
|
||||
cp yolo.bat ~
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@echo off
|
||||
|
||||
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 %*
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user