diff --git a/requirements.txt b/requirements.txt index d1f36be..00f22bc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ openai==0.27 termcolor==2.2.0 colorama -python-dotenv \ No newline at end of file +python-dotenv +distro \ No newline at end of file diff --git a/yolo.py b/yolo.py index 5b8ac8f..b40bbfe 100755 --- a/yolo.py +++ b/yolo.py @@ -9,11 +9,12 @@ import platform import openai import sys import subprocess +import dotenv +import distro + from termcolor import colored from colorama import init -import dotenv #Allow .env file to be used - # Check if the user globally disabled the safety switch def get_yolo_safety_switch_config(): @@ -60,8 +61,7 @@ def get_os_friendly_name(): os_name = platform.system() if os_name == "Linux": - dist_name = platform.freedesktop_os_release()["NAME"] - return "Linux/"+dist_name + return "Linux/"+distro.name(pretty=True) elif os_name == "Windows": return os_name elif os_name == "Darwin": @@ -115,12 +115,14 @@ if __name__ == "__main__": print ("No user prompt specified.") sys.exit(-1) + # Load the correct prompt based on Shell and OS and append the user's prompt prompt = get_full_prompt(user_prompt, shell) # Make the first line also the system prompt - system_prompt = prompt.split("\n")[0] - + system_prompt = prompt[1] + #print(prompt) + # Call the ChatGPT API response = openai.ChatCompletion.create( model="gpt-3.5-turbo", @@ -129,10 +131,7 @@ if __name__ == "__main__": {"role": "user", "content": prompt} ], temperature=0, - max_tokens=100, - # top_p=1, - # frequency_penalty=0.2, - # presence_penalty=0 + max_tokens=500, ) #print (response) @@ -162,4 +161,4 @@ if yolo == "Y" or yolo == "": subprocess.run([shell, "/c", res_command], shell=False) else: # Unix: /bin/bash /bin/zsh: uses -c both Ubuntu and macOS should work, others might not - subprocess.run([shell, "-c", res_command], shell=False) + subprocess.run([shell, "-c", res_command], shell=False) \ No newline at end of file