|
|
@ -38,11 +38,8 @@ class Standalone: |
|
|
|
load_dotenv(env_file) |
|
|
|
load_dotenv(env_file) |
|
|
|
try: |
|
|
|
try: |
|
|
|
apikey = os.environ["OPENAI_API_KEY"] |
|
|
|
apikey = os.environ["OPENAI_API_KEY"] |
|
|
|
except: |
|
|
|
|
|
|
|
pass |
|
|
|
|
|
|
|
self.client = OpenAI() |
|
|
|
self.client = OpenAI() |
|
|
|
self.client.api_key = apikey |
|
|
|
self.client.api_key = apikey |
|
|
|
|
|
|
|
|
|
|
|
except FileNotFoundError: |
|
|
|
except FileNotFoundError: |
|
|
|
print("No API key found. Use the --apikey option to set the key") |
|
|
|
print("No API key found. Use the --apikey option to set the key") |
|
|
|
sys.exit() |
|
|
|
sys.exit() |
|
|
@ -433,9 +430,11 @@ class Setup: |
|
|
|
openaiapikey = os.environ["OPENAI_API_KEY"] |
|
|
|
openaiapikey = os.environ["OPENAI_API_KEY"] |
|
|
|
self.openaiapi_key = openaiapikey |
|
|
|
self.openaiapi_key = openaiapikey |
|
|
|
except KeyError: |
|
|
|
except KeyError: |
|
|
|
print("OPENAI_API_KEY not found in environment variables.") |
|
|
|
self.openaiapi_key = "" |
|
|
|
sys.exit() |
|
|
|
try: |
|
|
|
self.fetch_available_models() |
|
|
|
self.fetch_available_models() |
|
|
|
|
|
|
|
except: |
|
|
|
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
def fetch_available_models(self): |
|
|
|
def fetch_available_models(self): |
|
|
|
headers = { |
|
|
|
headers = { |
|
|
|