File size: 1,733 Bytes
ef7f3ab |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
#----------------------------------------------------------
#update logic
import os
import json
#check if config file exists
if not os.path.isfile(os.path.join(os.path.dirname(os.path.realpath(__file__)),"config.json")):
#create config file
config = {
"autoUpdate": True,
"branch": "main",
"openAI_API_Key": "sk-#########################################"
}
with open(os.path.join(os.path.dirname(os.path.realpath(__file__)),"config.json"), "w") as f:
json.dump(config, f, indent=4)
#load config file
with open(os.path.join(os.path.dirname(os.path.realpath(__file__)),"config.json"), "r") as f:
config = json.load(f)
#check if autoUpdate is set
if "autoUpdate" not in config:
config["autoUpdate"] = False
#check if version is set
if "version" not in config:
config["branch"] = "main"
if config["autoUpdate"] == True:
try:
from .update import update as update
currentPath = os.path.dirname(os.path.realpath(__file__))
#run update/update.py to update the node class mappings
update.update(currentPath,branch_name=config["branch"])
except ImportError:
print("Failed to auto update `Quality of Life Suit` ")
#----------------------------------------------------------
from .src.QualityOfLifeSuit_Omar92 import NODE_CLASS_MAPPINGS as NODE_CLASS_MAPPINGS_SUIT
try:
from .src.QualityOfLife_deprecatedNodes import NODE_CLASS_MAPPINGS as NODE_CLASS_MAPPINGS_DEPRECATED
except ImportError:
NODE_CLASS_MAPPINGS_DEPRECATED = {}
__all__ = ['NODE_CLASS_MAPPINGS_SUIT', 'NODE_CLASS_MAPPINGS_DEPRECATED', 'NODE_CLASS_MAPPINGS']
NODE_CLASS_MAPPINGS = {
**NODE_CLASS_MAPPINGS_SUIT,
**NODE_CLASS_MAPPINGS_DEPRECATED
} |