Merge pull request #77 from VE-FORBRYDERNE/patch

Create settings directory if it doesn't exist when using InferKit/OAI
This commit is contained in:
henk717 2021-10-28 23:29:17 +02:00 committed by GitHub
commit c59673efde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)) print("{0}Please enter your InferKit API key:{1}\n".format(colors.CYAN, colors.END))
vars.apikey = input("Key> ") vars.apikey = input("Key> ")
# Write API key to file # Write API key to file
os.makedirs('settings', exist_ok=True)
file = open("settings/" + getmodelname() + ".settings", "w") file = open("settings/" + getmodelname() + ".settings", "w")
try: try:
js = {"apikey": vars.apikey} 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)) print("{0}Please enter your OpenAI API key:{1}\n".format(colors.CYAN, colors.END))
vars.oaiapikey = input("Key> ") vars.oaiapikey = input("Key> ")
# Write API key to file # Write API key to file
os.makedirs('settings', exist_ok=True)
file = open("settings/" + getmodelname() + ".settings", "w") file = open("settings/" + getmodelname() + ".settings", "w")
try: try:
js = {"oaiapikey": vars.oaiapikey} js = {"oaiapikey": vars.oaiapikey}