forked from ZHO-ZHO-ZHO/ComfyUI-Gemini
-
Notifications
You must be signed in to change notification settings - Fork 0
/
__init__.py
54 lines (40 loc) · 1.77 KB
/
__init__.py
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
import os
import sys
import filecmp
import shutil
import __main__
import json
python = sys.executable
extentions_folder = os.path.join(os.path.dirname(os.path.realpath(__main__.__file__)),
"web" + os.sep + "extensions" + os.sep + "Gemini_Zho")
javascript_folder = os.path.join(os.path.dirname(os.path.realpath(__file__)), "js")
if not os.path.exists(extentions_folder):
print('Making the "web\extensions\Gemini_Zho" folder')
os.mkdir(extentions_folder)
result = filecmp.dircmp(javascript_folder, extentions_folder)
if result.left_only or result.diff_files:
print('Update to javascripts files detected')
file_list = list(result.left_only)
file_list.extend(x for x in result.diff_files if x not in file_list)
for file in file_list:
print(f'Copying {file} to extensions folder')
src_file = os.path.join(javascript_folder, file)
dst_file = os.path.join(extentions_folder, file)
if os.path.exists(dst_file):
os.remove(dst_file)
#print("disabled")
shutil.copy(src_file, dst_file)
# create config
if not os.path.isfile(os.path.join(os.path.dirname(os.path.realpath(__file__)),"config.json")):
config = {
"GEMINI_API_KEY": "your key"
}
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
with open(os.path.join(os.path.dirname(os.path.realpath(__file__)),"config.json"), "r") as f:
config = json.load(f)
from .GeminiAPINode import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
# Combine the dictionaries
#NODE_CLASS_MAPPINGS = {**NODE_CLASS_MAPPINGS_G}
__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']