Create settings directory if it doesn't exist when using InferKit/OAI

This commit is contained in:
Gnome Ann 2021-10-21 23:33:32 -04:00
parent 9513240dfb
commit 3501f03153
1 changed files with 2 additions and 0 deletions

View File

@ -276,6 +276,7 @@ if(vars.model == "InferKit"):
print("{0}Please enter your InferKit API key:{1}\n".format(colors.CYAN, colors.END))
vars.apikey = input("Key> ")
# Write API key to file
os.makedirs('settings', exist_ok=True)
file = open("settings/" + getmodelname() + ".settings", "w")
try:
js = {"apikey": vars.apikey}
@ -310,6 +311,7 @@ if(vars.model == "OAI"):
print("{0}Please enter your OpenAI API key:{1}\n".format(colors.CYAN, colors.END))
vars.oaiapikey = input("Key> ")
# Write API key to file
os.makedirs('settings', exist_ok=True)
file = open("settings/" + getmodelname() + ".settings", "w")
try:
js = {"oaiapikey": vars.oaiapikey}