bizyengine 1.2.2__tar.gz → 1.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. {bizyengine-1.2.2 → bizyengine-1.2.3}/PKG-INFO +1 -1
  2. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/__init__.py +1 -0
  3. bizyengine-1.2.3/bizyengine/bizyair_extras/nodes_nunchaku.py +193 -0
  4. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/core/common/client.py +44 -31
  5. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/core/common/env_var.py +6 -3
  6. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/core/configs/models.json +1 -0
  7. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/core/configs/models.yaml +11 -0
  8. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/misc/auth.py +15 -26
  9. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/misc/utils.py +2 -2
  10. bizyengine-1.2.3/bizyengine/version.txt +1 -0
  11. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine.egg-info/PKG-INFO +1 -1
  12. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine.egg-info/SOURCES.txt +1 -0
  13. bizyengine-1.2.2/bizyengine/version.txt +0 -1
  14. {bizyengine-1.2.2 → bizyengine-1.2.3}/MANIFEST.in +0 -0
  15. {bizyengine-1.2.2 → bizyengine-1.2.3}/README.md +0 -0
  16. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/__init__.py +0 -0
  17. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizy_server/__init__.py +0 -0
  18. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizy_server/api_client.py +0 -0
  19. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizy_server/errno.py +0 -0
  20. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizy_server/error_handler.py +0 -0
  21. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizy_server/execution.py +0 -0
  22. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizy_server/profile.py +0 -0
  23. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizy_server/resp.py +0 -0
  24. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizy_server/server.py +0 -0
  25. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizy_server/utils.py +0 -0
  26. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/nodes_advanced_refluxcontrol.py +0 -0
  27. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/nodes_cogview4.py +0 -0
  28. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/nodes_comfyui_detail_daemon.py +0 -0
  29. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/nodes_comfyui_instantid.py +0 -0
  30. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/nodes_comfyui_layerstyle_advance.py +0 -0
  31. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/nodes_comfyui_pulid_flux.py +0 -0
  32. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/nodes_controlnet.py +0 -0
  33. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/nodes_custom_sampler.py +0 -0
  34. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/nodes_dataset.py +0 -0
  35. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/nodes_differential_diffusion.py +0 -0
  36. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/nodes_flux.py +0 -0
  37. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/nodes_image_utils.py +0 -0
  38. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/nodes_ip2p.py +0 -0
  39. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/nodes_ipadapter_plus/__init__.py +0 -0
  40. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/nodes_ipadapter_plus/nodes_ipadapter_plus.py +0 -0
  41. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/nodes_janus_pro.py +0 -0
  42. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/nodes_kolors_mz/__init__.py +0 -0
  43. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/nodes_model_advanced.py +0 -0
  44. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/nodes_sd3.py +0 -0
  45. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/nodes_segment_anything.py +0 -0
  46. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/nodes_segment_anything_utils.py +0 -0
  47. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/nodes_testing_utils.py +0 -0
  48. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/nodes_trellis.py +0 -0
  49. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/nodes_ultimatesdupscale.py +0 -0
  50. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/nodes_upscale_model.py +0 -0
  51. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/nodes_wan_video.py +0 -0
  52. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/oauth_callback/main.py +0 -0
  53. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/bizyair_extras/route_bizyair_tools.py +0 -0
  54. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/core/__init__.py +0 -0
  55. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/core/commands/__init__.py +0 -0
  56. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/core/commands/base.py +0 -0
  57. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/core/commands/invoker.py +0 -0
  58. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/core/commands/processors/model_hosting_processor.py +0 -0
  59. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/core/commands/processors/prompt_processor.py +0 -0
  60. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/core/commands/servers/model_server.py +0 -0
  61. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/core/commands/servers/prompt_server.py +0 -0
  62. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/core/common/__init__.py +0 -0
  63. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/core/common/caching.py +0 -0
  64. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/core/common/utils.py +0 -0
  65. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/core/configs/conf.py +0 -0
  66. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/core/data_types.py +0 -0
  67. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/core/image_utils.py +0 -0
  68. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/core/nodes_base.py +0 -0
  69. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/core/nodes_io.py +0 -0
  70. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/core/path_utils/__init__.py +0 -0
  71. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/core/path_utils/path_manager.py +0 -0
  72. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/core/path_utils/utils.py +0 -0
  73. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/misc/__init__.py +0 -0
  74. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/misc/llm.py +0 -0
  75. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/misc/mzkolors.py +0 -0
  76. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/misc/nodes.py +0 -0
  77. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/misc/nodes_controlnet_aux.py +0 -0
  78. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/misc/nodes_controlnet_union_sdxl.py +0 -0
  79. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/misc/route_sam.py +0 -0
  80. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/misc/segment_anything.py +0 -0
  81. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine/misc/supernode.py +0 -0
  82. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine.egg-info/dependency_links.txt +0 -0
  83. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine.egg-info/requires.txt +0 -0
  84. {bizyengine-1.2.2 → bizyengine-1.2.3}/bizyengine.egg-info/top_level.txt +0 -0
  85. {bizyengine-1.2.2 → bizyengine-1.2.3}/pyproject.toml +0 -0
  86. {bizyengine-1.2.2 → bizyengine-1.2.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bizyengine
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: [a/BizyAir](https://github.com/siliconflow/BizyAir) Comfy Nodes that can run in any environment.
5
5
  Author-email: SiliconFlow <yaochi@siliconflow.cn>
6
6
  Project-URL: Repository, https://github.com/siliconflow/BizyAir
@@ -15,6 +15,7 @@ from .nodes_ipadapter_plus.nodes_ipadapter_plus import *
15
15
  from .nodes_janus_pro import *
16
16
  from .nodes_kolors_mz import *
17
17
  from .nodes_model_advanced import *
18
+ from .nodes_nunchaku import *
18
19
  from .nodes_sd3 import *
19
20
  from .nodes_segment_anything import *
20
21
  from .nodes_testing_utils import *
@@ -0,0 +1,193 @@
1
+ from bizyengine.core import BizyAirBaseNode, BizyAirNodeIO, data_types
2
+ from bizyengine.core.configs.conf import config_manager
3
+ from bizyengine.core.path_utils import path_manager as folder_paths
4
+
5
+
6
+ class NunchakuFluxDiTLoader(BizyAirBaseNode):
7
+ @classmethod
8
+ def INPUT_TYPES(s):
9
+ attention_options = ["nunchaku-fp16"]
10
+ dtype_options = ["bfloat16"]
11
+ return {
12
+ "required": {
13
+ "model_path": (
14
+ ["svdq-int4-flux.1-dev"],
15
+ {"tooltip": "The SVDQuant quantized FLUX.1 models."},
16
+ ),
17
+ "cache_threshold": (
18
+ "FLOAT",
19
+ {
20
+ "default": 0,
21
+ "min": 0,
22
+ "max": 1,
23
+ "step": 0.001,
24
+ "tooltip": "Adjusts the caching tolerance like `residual_diff_threshold` in WaveSpeed. "
25
+ "Increasing the value enhances speed at the cost of quality. "
26
+ "A typical setting is 0.12. Setting it to 0 disables the effect.",
27
+ },
28
+ ),
29
+ "attention": (
30
+ attention_options,
31
+ {
32
+ "default": attention_options[0],
33
+ "tooltip": "Attention implementation. The default implementation is `flash-attention2`. "
34
+ "`nunchaku-fp16` use FP16 attention, offering ~1.2× speedup. "
35
+ "Note that 20-series GPUs can only use `nunchaku-fp16`.",
36
+ },
37
+ ),
38
+ "cpu_offload": (
39
+ ["disable"],
40
+ {
41
+ "default": "auto",
42
+ "tooltip": "Whether to enable CPU offload for the transformer model."
43
+ "auto' will enable it if the GPU memory is less than 14G.",
44
+ },
45
+ ),
46
+ "device_id": (
47
+ "INT",
48
+ {
49
+ "default": 0,
50
+ "min": 0,
51
+ "max": 0,
52
+ "step": 1,
53
+ "display": "number",
54
+ "lazy": True,
55
+ "tooltip": "The GPU device ID to use for the model.",
56
+ },
57
+ ),
58
+ "data_type": (
59
+ dtype_options,
60
+ {
61
+ "default": dtype_options[0],
62
+ "tooltip": "Specifies the model's data type. Default is `bfloat16`. "
63
+ "For 20-series GPUs, which do not support `bfloat16`, use `float16` instead.",
64
+ },
65
+ ),
66
+ },
67
+ "optional": {
68
+ "i2f_mode": (
69
+ ["enabled", "always"],
70
+ {
71
+ "default": "enabled",
72
+ "tooltip": "The GEMM implementation for 20-series GPUs"
73
+ "— this option is only applicable to these GPUs.",
74
+ },
75
+ )
76
+ },
77
+ }
78
+
79
+ RETURN_TYPES = (data_types.MODEL,)
80
+ CATEGORY = "Nunchaku"
81
+ NODE_DISPLAY_NAME = "Nunchaku FLUX DiT Loader"
82
+
83
+
84
+ class NunchakuTextEncoderLoader(BizyAirBaseNode):
85
+ @classmethod
86
+ def INPUT_TYPES(s):
87
+ return {
88
+ "required": {
89
+ "model_type": (["flux"],),
90
+ "text_encoder1": (folder_paths.get_filename_list("text_encoders"),),
91
+ "text_encoder2": (folder_paths.get_filename_list("text_encoders"),),
92
+ "t5_min_length": (
93
+ "INT",
94
+ {
95
+ "default": 512,
96
+ "min": 256,
97
+ "max": 1024,
98
+ "step": 128,
99
+ "display": "number",
100
+ "lazy": True,
101
+ },
102
+ ),
103
+ "use_4bit_t5": (["disable"],),
104
+ "int4_model": (
105
+ ["none"],
106
+ {"tooltip": "The name of the 4-bit T5 model."},
107
+ ),
108
+ }
109
+ }
110
+
111
+ RETURN_TYPES = (data_types.CLIP,)
112
+ # FUNCTION = "load_text_encoder"
113
+ CATEGORY = "Nunchaku"
114
+ NODE_DISPLAY_NAME = "Nunchaku Text Encoder Loader"
115
+
116
+
117
+ class NunchakuFluxLoraLoader(BizyAirBaseNode):
118
+ @classmethod
119
+ def INPUT_TYPES(s):
120
+ return {
121
+ "required": {
122
+ "model": (
123
+ data_types.MODEL,
124
+ {"tooltip": "The diffusion model the LoRA will be applied to."},
125
+ ),
126
+ "lora_name": (
127
+ [
128
+ "to choose",
129
+ ],
130
+ {"tooltip": "The name of the LoRA."},
131
+ ),
132
+ "lora_strength": (
133
+ "FLOAT",
134
+ {
135
+ "default": 1.0,
136
+ "min": -100.0,
137
+ "max": 100.0,
138
+ "step": 0.01,
139
+ "tooltip": "How strongly to modify the diffusion model. This value can be negative.",
140
+ },
141
+ ),
142
+ "model_version_id": (
143
+ "STRING",
144
+ {
145
+ "default": "",
146
+ },
147
+ ),
148
+ }
149
+ }
150
+
151
+ RETURN_TYPES = (data_types.MODEL,)
152
+ OUTPUT_TOOLTIPS = ("The modified diffusion model.",)
153
+ FUNCTION = "load_lora"
154
+ NODE_DISPLAY_NAME = "Nunchaku FLUX.1 LoRA Loader"
155
+
156
+ CATEGORY = "Nunchaku"
157
+ DESCRIPTION = (
158
+ "LoRAs are used to modify the diffusion model, "
159
+ "altering the way in which latents are denoised such as applying styles. "
160
+ "You can link multiple LoRA nodes."
161
+ )
162
+
163
+ @classmethod
164
+ def VALIDATE_INPUTS(cls, lora_name, **kwargs):
165
+ if lora_name == "" or lora_name is None:
166
+ return False
167
+ return True
168
+
169
+ def load_lora(
170
+ self,
171
+ model,
172
+ lora_name,
173
+ lora_strength,
174
+ model_version_id: str = None,
175
+ ):
176
+ assigned_id = self.assigned_id
177
+ new_model: BizyAirNodeIO = model.copy(assigned_id)
178
+
179
+ if model_version_id is not None and model_version_id != "":
180
+ # use model version id as lora name
181
+ lora_name = (
182
+ f"{config_manager.get_model_version_id_prefix()}{model_version_id}"
183
+ )
184
+ new_model.add_node_data(
185
+ class_type="NunchakuFluxLoraLoader",
186
+ inputs={
187
+ "model": model,
188
+ "lora_name": lora_name,
189
+ "lora_strength": lora_strength,
190
+ },
191
+ outputs={"slot_index": 0},
192
+ )
193
+ return (new_model,)
@@ -1,4 +1,5 @@
1
1
  import json
2
+ import logging
2
3
  import os
3
4
  import pprint
4
5
  import urllib.error
@@ -17,9 +18,12 @@ __all__ = ["send_request"]
17
18
 
18
19
  from dataclasses import dataclass, field
19
20
 
20
- from .env_var import BIZYAIR_API_KEY, BIZYAIR_DEBUG, BIZYAIR_SERVER_ADDRESS
21
-
22
- IS_API_KEY_VALID = None
21
+ from .env_var import (
22
+ BIZYAIR_API_KEY,
23
+ BIZYAIR_DEBUG,
24
+ BIZYAIR_SERVER_ADDRESS,
25
+ create_api_key_file,
26
+ )
23
27
 
24
28
  version_path = os.path.join(os.path.dirname(__file__), "..", "..", "version.txt")
25
29
  with open(version_path, "r") as file:
@@ -29,34 +33,39 @@ with open(version_path, "r") as file:
29
33
  @dataclass
30
34
  class APIKeyState:
31
35
  current_api_key: str = field(default=None)
32
- is_valid: bool = field(default=None)
36
+ is_valid: bool = field(default=False)
33
37
 
34
38
 
39
+ # Actual api key in use
35
40
  api_key_state = APIKeyState()
36
41
 
37
42
 
38
- def set_api_key(api_key: str = "YOUR_API_KEY", override: bool = False):
39
- global BIZYAIR_API_KEY, api_key_state
40
- if api_key_state.is_valid is not None and not override:
43
+ def set_api_key(api_key: str = "YOUR_API_KEY", override: bool = False) -> bool:
44
+ logging.debug("client.py set_api_key called")
45
+ global api_key_state
46
+ if api_key_state.is_valid and not override:
41
47
  warnings.warn("API key has already been set and will not be overridden.")
42
- return
48
+ return True
43
49
  if validate_api_key(api_key):
44
- BIZYAIR_API_KEY = api_key
50
+ create_api_key_file(api_key)
45
51
  api_key_state.is_valid = True
46
- print("\033[92mAPI key is set successfully.\033[0m")
52
+ api_key_state.current_api_key = api_key
53
+ logging.info("\033[92mAPI key is set successfully.\033[0m")
54
+ return True
47
55
  else:
48
- api_key_state.is_valid = False
49
56
  warnings.warn("Invalid API key provided.")
57
+ return False
50
58
 
51
59
 
52
60
  def validate_api_key(api_key: str = None) -> bool:
53
- global api_key_state
61
+ logging.debug("validating api key...")
54
62
  if not api_key or not isinstance(api_key, str):
55
- warnings.warn("API key is not set.")
63
+ warnings.warn("invalid api_key")
56
64
  return False
65
+
66
+ is_valid = False
57
67
  # if api_key_state.current_api_key == api_key and api_key_state.is_valid is not None:
58
68
  # return api_key_state.is_valid
59
- api_key_state.current_api_key = api_key
60
69
  url = f"{BIZYAIR_SERVER_ADDRESS}/user/info"
61
70
  headers = {"accept": "application/json", "authorization": f"Bearer {api_key}"}
62
71
  try:
@@ -64,34 +73,37 @@ def validate_api_key(api_key: str = None) -> bool:
64
73
  method="GET", url=url, headers=headers, callback=None
65
74
  )
66
75
  if "message" not in response_data or response_data["message"] != "Ok":
67
- api_key_state.is_valid = False
68
76
  raise ValueError(
69
77
  f"\033[91mAPI key validation failed. API Key: {api_key}\033[0m"
70
78
  )
71
79
  else:
72
- api_key_state.is_valid = True
80
+ is_valid = True
73
81
  except ConnectionError as ce:
74
- api_key_state.is_valid = False
75
82
  raise ValueError(f"\033[91mConnection error: {ce}\033[0m")
76
83
  except PermissionError as pe:
77
- api_key_state.is_valid = False
78
84
  raise ValueError(
79
85
  f"\033[91mError validating API key: {api_key}, error: {pe}\033[0m"
80
86
  )
81
87
  except Exception as e:
82
- api_key_state.is_valid = False
83
88
  raise ValueError(f"\033[91mOther error: {e}\033[0m")
84
- return api_key_state.is_valid
89
+
90
+ logging.debug(f"api key validated: {is_valid}")
91
+ return is_valid
85
92
 
86
93
 
87
94
  def get_api_key() -> str:
88
- global BIZYAIR_API_KEY
95
+ logging.debug("client.py get_api_key called")
96
+ global api_key_state
89
97
  try:
90
- validate_api_key(BIZYAIR_API_KEY)
98
+ if not api_key_state.is_valid:
99
+ if validate_api_key(BIZYAIR_API_KEY):
100
+ api_key_state.is_valid = True
101
+ api_key_state.current_api_key = BIZYAIR_API_KEY
102
+ logging.info("API key set successfully")
91
103
  except Exception as e:
92
- print(str(e))
104
+ logging.error(str(e))
93
105
  raise ValueError(str(e))
94
- return BIZYAIR_API_KEY
106
+ return api_key_state.current_api_key
95
107
 
96
108
 
97
109
  def _headers():
@@ -141,8 +153,8 @@ def send_request(
141
153
  error_message = str(e)
142
154
  response_body = e.read().decode("utf-8") if hasattr(e, "read") else "N/A"
143
155
  if verbose:
144
- print(f"URLError encountered: {error_message}")
145
- print(f"Response Body: {response_data}")
156
+ logging.error(f"URLError encountered: {error_message}")
157
+ logging.info(f"Response Body: {response_data}")
146
158
  code, message = "N/A", "N/A"
147
159
  try:
148
160
  response_dict = json.loads(response_body)
@@ -152,7 +164,7 @@ def send_request(
152
164
 
153
165
  except json.JSONDecodeError:
154
166
  if verbose:
155
- print("Failed to decode response body as JSON.")
167
+ logging.error("Failed to decode response body as JSON.")
156
168
 
157
169
  if "Unauthorized" in error_message:
158
170
  raise PermissionError(
@@ -234,7 +246,7 @@ async def async_send_request(
234
246
  if response.status != 200:
235
247
  error_message = f"HTTP Status {response.status}"
236
248
  if verbose:
237
- print(f"Error encountered: {error_message}")
249
+ logging.error(f"Error encountered: {error_message}")
238
250
  if response.status == 401:
239
251
  raise PermissionError(
240
252
  "Key is invalid, please refer to https://cloud.siliconflow.cn to get the API key.\n"
@@ -251,17 +263,18 @@ async def async_send_request(
251
263
  return callback(json.loads(response_data))
252
264
  return json.loads(response_data)
253
265
  except aiohttp.ClientError as e:
254
- print(f"Error fetching data: {e}")
266
+ logging.error(f"Error fetching data: {e}")
255
267
  return {}
256
268
  except Exception as e:
257
- print(f"Error fetching data: {str(e)}")
269
+ logging.error(f"Error fetching data: {str(e)}")
258
270
  return {}
259
271
 
260
272
 
261
273
  def fetch_models_by_type(
262
274
  url: str, model_type: str, *, method="GET", verbose=False
263
275
  ) -> dict:
264
- if not validate_api_key(BIZYAIR_API_KEY):
276
+ global api_key_state
277
+ if not api_key_state.is_valid:
265
278
  return {}
266
279
 
267
280
  payload = {"type": model_type}
@@ -1,4 +1,5 @@
1
1
  import configparser
2
+ import logging
2
3
  import os
3
4
  from os import environ
4
5
  from pathlib import Path
@@ -59,7 +60,7 @@ def env(key, type_, default=None):
59
60
 
60
61
 
61
62
  def load_api_key():
62
-
63
+ logging.debug("load_api_key called")
63
64
  file_path = BIZYAIR_COMFYUI_PATH / "api_key.ini"
64
65
 
65
66
  if file_path.is_file() and file_path.exists():
@@ -73,6 +74,7 @@ def load_api_key():
73
74
 
74
75
 
75
76
  def create_api_key_file(api_key):
77
+ logging.debug("create_api_key_file called")
76
78
  config = configparser.ConfigParser()
77
79
  config["auth"] = {"api_key": api_key}
78
80
  file_path = BIZYAIR_COMFYUI_PATH / "api_key.ini"
@@ -84,9 +86,9 @@ def create_api_key_file(api_key):
84
86
 
85
87
 
86
88
  # production:
87
- # service_address: https://bizyair-api.siliconflow.cn/x/v1
89
+ # service_address: https://api.bizyair.cn/x/v1
88
90
  # uat:
89
- # service_address: https://uat-bizyair-api.siliconflow.cn/x/v1
91
+ # service_address: https://uat-api.bizyair.cn/x/v1
90
92
  _BIZYAIR_DOMAIN = os.getenv("BIZYAIR_DOMAIN", "https://api.bizyair.cn")
91
93
  BIZYAIR_DOMAIN = ServerAddress(_BIZYAIR_DOMAIN)
92
94
  BIZYAIR_X_SERVER = f"{_BIZYAIR_DOMAIN}/x/v1"
@@ -94,6 +96,7 @@ BIZYAIR_Y_SERVER = f"{_BIZYAIR_DOMAIN}/y/v1"
94
96
 
95
97
  BIZYAIR_SERVER_ADDRESS = ServerAddress(BIZYAIR_X_SERVER)
96
98
 
99
+ # Initial value, DO NOT CHANGE IN ACTUAL CODE!!!
97
100
  BIZYAIR_API_KEY = env("BIZYAIR_API_KEY", str, load_api_key()[1])
98
101
  # Development Settings
99
102
  BIZYAIR_DEV_REQUEST_URL = env("BIZYAIR_DEV_REQUEST_URL", str, None)
@@ -82,6 +82,7 @@
82
82
  "t5xxl_fp16.safetensors",
83
83
  "t5xxl_fp8_e4m3fn.safetensors"
84
84
  ],
85
+ "text_encoders":["t5xxl_fp16.safetensors","clip_l.safetensors"],
85
86
  "upscale_models": [
86
87
  "4x_NMKD-Siax_200k.pth",
87
88
  "RealESRGAN_x4plus.pth",
@@ -52,6 +52,17 @@ model_rules:
52
52
  unet_name:
53
53
  - ^flux/flux1-schnell.sft$
54
54
 
55
+ - mode_type: unet
56
+ base_model: FLUX
57
+ describe: NunchakuFluxDiT
58
+ score: 5
59
+ route: /supernode/bizyair-flux-nunchaku1-unet
60
+ nodes:
61
+ - class_type: NunchakuFluxDiTLoader
62
+ inputs:
63
+ model_path:
64
+ - '.*'
65
+
55
66
  - mode_type: unet
56
67
  base_model: Shuttle
57
68
  describe: shuttle-3.1-aesthetic
@@ -1,23 +1,17 @@
1
+ import logging
1
2
  import os
2
3
  import uuid
3
4
  from pathlib import Path
4
5
 
5
- import bizyengine.core
6
+ import bizyengine.core.common
6
7
  import server
7
8
  from aiohttp import web
8
- from bizyengine.core.common import create_api_key_file, load_api_key, validate_api_key
9
9
 
10
- API_KEY = None
11
10
  # html_file_path = Path(os.path.dirname(os.path.abspath(__file__))) / "set_api_key.html"
12
11
  # with open(html_file_path, "r", encoding="utf-8") as htmlfile:
13
12
  # set_api_key_html = htmlfile.read()
14
13
 
15
14
 
16
- has_key, api_key = load_api_key()
17
- if has_key:
18
- API_KEY = api_key
19
-
20
-
21
15
  # @server.PromptServer.instance.routes.get("/bizyair/set-api-key")
22
16
  # async def set_api_key_page(request):
23
17
  # return web.Response(text=set_api_key_html, content_type="text/html")
@@ -25,55 +19,50 @@ if has_key:
25
19
 
26
20
  @server.PromptServer.instance.routes.post("/bizyair/set_api_key")
27
21
  async def set_api_key(request):
28
- global API_KEY
29
22
  try:
30
23
  data = await request.post()
31
24
  api_key = data.get("api_key")
32
25
  if api_key:
33
- if not validate_api_key(api_key):
26
+ if not bizyengine.core.common.set_api_key(api_key, True):
34
27
  error_msg = "Wrong API key provided, please refer to cloud.siliconflow.cn to get the key"
35
- print("set_api_key:", error_msg)
28
+ logging.error("set_api_key:", error_msg)
36
29
  return web.Response(
37
30
  text=error_msg,
38
31
  status=400,
39
32
  )
40
- create_api_key_file(api_key)
41
- API_KEY = api_key
42
- bizyengine.core.set_api_key(API_KEY, override=True)
43
- print("Set the key sucessfully.")
33
+ logging.info("Set api key sucessfully.")
44
34
  return web.Response(text="ok")
45
35
  else:
46
36
  error_msg = "No API key provided, please refer to cloud.siliconflow.cn to get the key"
47
- print("set_api_key:", error_msg)
37
+ logging.error("set_api_key:", error_msg)
48
38
  return web.Response(
49
39
  text=error_msg,
50
40
  status=400,
51
41
  )
52
42
  except Exception as e:
53
- print(f"set api key error: {str(e)}")
43
+ logging.error(f"set api key error: {str(e)}")
54
44
  return web.Response(text=str(e), status=500)
55
45
 
56
46
 
57
47
  @server.PromptServer.instance.routes.get("/bizyair/get_api_key")
58
48
  async def get_api_key(request):
59
- global API_KEY
49
+ logging.debug("auth.py get_api_key called")
60
50
  try:
61
- has_key, api_key = load_api_key()
62
- if has_key:
63
- API_KEY = api_key
64
- bizyengine.core.set_api_key(API_KEY)
51
+ if bizyengine.core.common.get_api_key():
65
52
  return web.Response(text="Key has been loaded from the api_key.ini file")
66
53
  else:
54
+ logging.debug("getting api key from cookie")
67
55
  api_key = request.cookies.get("api_key")
68
56
  if not api_key:
69
- print("No api key found in cookies")
57
+ logging.error("No api key found in cookies")
70
58
  return web.Response(
71
59
  text="No api key found in cookies, please refer to cloud.siliconflow.cn to get the key",
72
60
  status=404,
73
61
  )
74
- API_KEY = api_key
75
- bizyengine.core.set_api_key(API_KEY)
76
- return web.Response(text="Key has been loaded from the cookies")
62
+ if bizyengine.core.common.set_api_key(api_key):
63
+ return web.Response(text="Key has been loaded from the cookies")
64
+ logging.error("cannot set api key")
65
+ return web.Response(text="Cannot set api key", status=500)
77
66
 
78
67
  except Exception as e:
79
68
  return web.Response(text=str(e), status=500)
@@ -123,9 +123,9 @@ def format_bytes(num_bytes: int) -> str:
123
123
 
124
124
 
125
125
  def get_api_key():
126
- from .auth import API_KEY
126
+ from bizyengine.core.common import get_api_key as bcc_get_api_key
127
127
 
128
- return API_KEY
128
+ return bcc_get_api_key()
129
129
 
130
130
 
131
131
  def get_llm_response(
@@ -0,0 +1 @@
1
+ 1.2.3
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bizyengine
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: [a/BizyAir](https://github.com/siliconflow/BizyAir) Comfy Nodes that can run in any environment.
5
5
  Author-email: SiliconFlow <yaochi@siliconflow.cn>
6
6
  Project-URL: Repository, https://github.com/siliconflow/BizyAir
@@ -33,6 +33,7 @@ bizyengine/bizyair_extras/nodes_image_utils.py
33
33
  bizyengine/bizyair_extras/nodes_ip2p.py
34
34
  bizyengine/bizyair_extras/nodes_janus_pro.py
35
35
  bizyengine/bizyair_extras/nodes_model_advanced.py
36
+ bizyengine/bizyair_extras/nodes_nunchaku.py
36
37
  bizyengine/bizyair_extras/nodes_sd3.py
37
38
  bizyengine/bizyair_extras/nodes_segment_anything.py
38
39
  bizyengine/bizyair_extras/nodes_segment_anything_utils.py
@@ -1 +0,0 @@
1
- 1.2.2
File without changes
File without changes
File without changes
File without changes