bizyengine 1.2.80__py3-none-any.whl → 1.2.82__py3-none-any.whl
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.
- bizyengine/bizy_server/api_client.py +22 -0
- bizyengine/bizy_server/errno.py +7 -0
- bizyengine/bizy_server/server.py +16 -0
- bizyengine/bizyair_extras/third_party_api/__init__.py +1 -0
- bizyengine/bizyair_extras/third_party_api/nodes_doubao.py +212 -0
- bizyengine/bizyair_extras/third_party_api/nodes_vlm.py +120 -0
- bizyengine/core/common/client.py +28 -32
- bizyengine/misc/utils.py +38 -0
- bizyengine/version.txt +1 -1
- {bizyengine-1.2.80.dist-info → bizyengine-1.2.82.dist-info}/METADATA +1 -1
- {bizyengine-1.2.80.dist-info → bizyengine-1.2.82.dist-info}/RECORD +13 -12
- {bizyengine-1.2.80.dist-info → bizyengine-1.2.82.dist-info}/WHEEL +0 -0
- {bizyengine-1.2.80.dist-info → bizyengine-1.2.82.dist-info}/top_level.txt +0 -0
|
@@ -1230,3 +1230,25 @@ class APIClient:
|
|
|
1230
1230
|
f"\033[31m[BizyAir]\033[0m Fail to get trd api node {model} pricing: {str(e)}"
|
|
1231
1231
|
)
|
|
1232
1232
|
return None, errnos.TRD_API_PRICING
|
|
1233
|
+
|
|
1234
|
+
async def get_trd_nodes_by_type(
|
|
1235
|
+
self, type, request_api_key: str = None
|
|
1236
|
+
) -> tuple[dict | None, ErrorNo | None]:
|
|
1237
|
+
server_url = f"{BIZYAIR_X_SERVER}/trd_api/nodes/query"
|
|
1238
|
+
headers, err = self.auth_header(api_key=request_api_key)
|
|
1239
|
+
if err is not None:
|
|
1240
|
+
return None, err
|
|
1241
|
+
|
|
1242
|
+
try:
|
|
1243
|
+
ret, err = await self.do_get(
|
|
1244
|
+
server_url, headers=headers, params={"model_type": type}
|
|
1245
|
+
)
|
|
1246
|
+
if err is not None:
|
|
1247
|
+
return None, err
|
|
1248
|
+
|
|
1249
|
+
return ret["data"], None
|
|
1250
|
+
except Exception as e:
|
|
1251
|
+
print(
|
|
1252
|
+
f"\033[31m[BizyAir]\033[0m Fail to get trd api node of type {type}: {str(e)}"
|
|
1253
|
+
)
|
|
1254
|
+
return None, errnos.GET_TRD_NODES
|
bizyengine/bizy_server/errno.py
CHANGED
bizyengine/bizy_server/server.py
CHANGED
|
@@ -985,6 +985,22 @@ class BizyAirServer:
|
|
|
985
985
|
return ErrResponse(err)
|
|
986
986
|
return OKResponse(pricing)
|
|
987
987
|
|
|
988
|
+
@self.prompt_server.routes.get(f"/{API_PREFIX}/trd_nodes")
|
|
989
|
+
async def get_trd_nodes_by_type(request):
|
|
990
|
+
from bizyengine.misc.utils import cache_trd_models, get_trd_models
|
|
991
|
+
|
|
992
|
+
request_api_key, err = _get_request_api_key(request.headers)
|
|
993
|
+
if err:
|
|
994
|
+
return ErrResponse(err)
|
|
995
|
+
type = request.rel_url.query.get("type", "")
|
|
996
|
+
if not type:
|
|
997
|
+
return ErrResponse(errnos.INVALID_TYPE)
|
|
998
|
+
cache_trd_models(type, request_api_key)
|
|
999
|
+
models = get_trd_models(type)
|
|
1000
|
+
if models is None:
|
|
1001
|
+
return ErrResponse(errnos.NO_MODEL_FOUND)
|
|
1002
|
+
return OKResponse(models)
|
|
1003
|
+
|
|
988
1004
|
# 服务器模式独占
|
|
989
1005
|
if BIZYAIR_SERVER_MODE:
|
|
990
1006
|
return
|
|
@@ -585,3 +585,215 @@ class Seedance_1_0_I2V_API(BizyAirTrdApiBaseNode):
|
|
|
585
585
|
|
|
586
586
|
def handle_outputs(self, outputs):
|
|
587
587
|
return (outputs[0][0], "")
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
class Seedance_1_5_T2V_API(BizyAirTrdApiBaseNode):
|
|
591
|
+
RETURN_TYPES = (
|
|
592
|
+
"VIDEO",
|
|
593
|
+
"""{"doubao-seedance-1-5-pro-251215": "doubao-seedance-1-5-pro"}""",
|
|
594
|
+
)
|
|
595
|
+
RETURN_NAMES = ("video", "bizyair_model_name")
|
|
596
|
+
CATEGORY = "☁️BizyAir/External APIs/Doubao"
|
|
597
|
+
NODE_DISPLAY_NAME = "Seedance 1.5 Pro Text To Video"
|
|
598
|
+
|
|
599
|
+
@classmethod
|
|
600
|
+
def INPUT_TYPES(cls):
|
|
601
|
+
return {
|
|
602
|
+
"required": {
|
|
603
|
+
"prompt": (
|
|
604
|
+
"STRING",
|
|
605
|
+
{
|
|
606
|
+
"multiline": True,
|
|
607
|
+
"default": "",
|
|
608
|
+
},
|
|
609
|
+
),
|
|
610
|
+
"model": (
|
|
611
|
+
["doubao-seedance-1-5-pro-251215"],
|
|
612
|
+
{"default": "doubao-seedance-1-5-pro-251215"},
|
|
613
|
+
),
|
|
614
|
+
"resolution": (
|
|
615
|
+
["480p", "720p", "1080p"],
|
|
616
|
+
{
|
|
617
|
+
"default": "1080p",
|
|
618
|
+
"tooltip": "分辨率+比例共同决定视频尺寸,具体尺寸请参考官方文档说明",
|
|
619
|
+
},
|
|
620
|
+
),
|
|
621
|
+
"ratio": (
|
|
622
|
+
["16:9", "4:3", "1:1", "3:4", "9:16", "21:9", "adaptive"],
|
|
623
|
+
{
|
|
624
|
+
"default": "adaptive",
|
|
625
|
+
"tooltip": "比例+分辨率共同决定视频尺寸,具体尺寸请参考官方文档说明",
|
|
626
|
+
},
|
|
627
|
+
),
|
|
628
|
+
"duration": ("INT", {"default": 12, "min": 2, "max": 12}),
|
|
629
|
+
"fps": (
|
|
630
|
+
[24],
|
|
631
|
+
{
|
|
632
|
+
"default": 24,
|
|
633
|
+
"tooltip": "帧率固定24",
|
|
634
|
+
},
|
|
635
|
+
),
|
|
636
|
+
"camerafixed": (
|
|
637
|
+
"BOOLEAN",
|
|
638
|
+
{
|
|
639
|
+
"default": False,
|
|
640
|
+
"tooltip": "平台可能在提示词中追加固定摄像机指令(效果不保证) ",
|
|
641
|
+
},
|
|
642
|
+
),
|
|
643
|
+
"generate_audio": (
|
|
644
|
+
"BOOLEAN",
|
|
645
|
+
{
|
|
646
|
+
"default": False,
|
|
647
|
+
"tooltip": "影响计费。控制生成的视频是否包含与画面同步的声音,Seedance 1.5 pro 能够基于文本提示词与视觉内容,自动生成与之匹配的人声、音效及背景音乐。建议将对话部分置于双引号内,以优化音频生成效果。例如:男人叫住女人说:“你记住,以后不可以用手指指月亮。”",
|
|
648
|
+
},
|
|
649
|
+
),
|
|
650
|
+
"seed": ("INT", {"default": -1, "min": -1, "max": 2147483647}),
|
|
651
|
+
},
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
def handle_inputs(self, headers, prompt_id, **kwargs):
|
|
655
|
+
model = kwargs.get("model", "doubao-seedance-1-5-pro-251215")
|
|
656
|
+
prompt = kwargs.get("prompt", "")
|
|
657
|
+
resolution = kwargs.get("resolution", "1080p")
|
|
658
|
+
ratio = kwargs.get("ratio", "adaptive")
|
|
659
|
+
duration = kwargs.get("duration", 12)
|
|
660
|
+
camerafixed = kwargs.get("camerafixed", False)
|
|
661
|
+
generate_audio = kwargs.get("generate_audio", False)
|
|
662
|
+
seed = kwargs.get("seed", -1)
|
|
663
|
+
if prompt is None or prompt.strip() == "":
|
|
664
|
+
raise ValueError("Prompt is required")
|
|
665
|
+
data = {
|
|
666
|
+
"prompt": prompt,
|
|
667
|
+
"model": model,
|
|
668
|
+
"resolution": resolution,
|
|
669
|
+
"ratio": ratio,
|
|
670
|
+
"duration": duration,
|
|
671
|
+
"camerafixed": camerafixed,
|
|
672
|
+
"seed": seed,
|
|
673
|
+
"watermark": False,
|
|
674
|
+
"fps": 24,
|
|
675
|
+
"generate_audio": generate_audio,
|
|
676
|
+
}
|
|
677
|
+
return data, "doubao-seedance-1-5-pro"
|
|
678
|
+
|
|
679
|
+
def handle_outputs(self, outputs):
|
|
680
|
+
return (outputs[0][0], "")
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
class Seedance_1_5_I2V_API(BizyAirTrdApiBaseNode):
|
|
684
|
+
RETURN_TYPES = (
|
|
685
|
+
"VIDEO",
|
|
686
|
+
"""{"doubao-seedance-1-5-pro-251215": "doubao-seedance-1-5-pro"}""",
|
|
687
|
+
)
|
|
688
|
+
RETURN_NAMES = ("video", "bizyair_model_name")
|
|
689
|
+
CATEGORY = "☁️BizyAir/External APIs/Doubao"
|
|
690
|
+
NODE_DISPLAY_NAME = "Seedance 1.5 Pro Image To Video"
|
|
691
|
+
|
|
692
|
+
@classmethod
|
|
693
|
+
def INPUT_TYPES(cls):
|
|
694
|
+
return {
|
|
695
|
+
"required": {
|
|
696
|
+
"first_frame_image": ("IMAGE",),
|
|
697
|
+
"prompt": (
|
|
698
|
+
"STRING",
|
|
699
|
+
{
|
|
700
|
+
"multiline": True,
|
|
701
|
+
"default": "",
|
|
702
|
+
},
|
|
703
|
+
),
|
|
704
|
+
"model": (
|
|
705
|
+
["doubao-seedance-1-5-pro-251215"],
|
|
706
|
+
{"default": "doubao-seedance-1-5-pro-251215"},
|
|
707
|
+
),
|
|
708
|
+
"resolution": (
|
|
709
|
+
["480p", "720p", "1080p"],
|
|
710
|
+
{
|
|
711
|
+
"default": "1080p",
|
|
712
|
+
"tooltip": "分辨率+比例共同决定视频尺寸,具体尺寸请参考官方文档说明",
|
|
713
|
+
},
|
|
714
|
+
),
|
|
715
|
+
"ratio": (
|
|
716
|
+
["16:9", "4:3", "1:1", "3:4", "9:16", "21:9", "adaptive"],
|
|
717
|
+
{
|
|
718
|
+
"default": "adaptive",
|
|
719
|
+
"tooltip": "比例+分辨率共同决定视频尺寸,具体尺寸请参考官方文档说明",
|
|
720
|
+
},
|
|
721
|
+
),
|
|
722
|
+
"duration": ("INT", {"default": 12, "min": 2, "max": 12}),
|
|
723
|
+
"fps": (
|
|
724
|
+
[24],
|
|
725
|
+
{
|
|
726
|
+
"default": 24,
|
|
727
|
+
"tooltip": "帧率固定24",
|
|
728
|
+
},
|
|
729
|
+
),
|
|
730
|
+
"camerafixed": (
|
|
731
|
+
"BOOLEAN",
|
|
732
|
+
{
|
|
733
|
+
"default": False,
|
|
734
|
+
"tooltip": "平台可能在提示词中追加固定摄像机指令(效果不保证) ",
|
|
735
|
+
},
|
|
736
|
+
),
|
|
737
|
+
"generate_audio": (
|
|
738
|
+
"BOOLEAN",
|
|
739
|
+
{
|
|
740
|
+
"default": False,
|
|
741
|
+
"tooltip": "影响计费。控制生成的视频是否包含与画面同步的声音,Seedance 1.5 pro 能够基于文本提示词与视觉内容,自动生成与之匹配的人声、音效及背景音乐。建议将对话部分置于双引号内,以优化音频生成效果。例如:男人叫住女人说:“你记住,以后不可以用手指指月亮。”",
|
|
742
|
+
},
|
|
743
|
+
),
|
|
744
|
+
"seed": ("INT", {"default": -1, "min": -1, "max": 2147483647}),
|
|
745
|
+
},
|
|
746
|
+
"optional": {
|
|
747
|
+
"last_frame_image": ("IMAGE",),
|
|
748
|
+
},
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
def handle_inputs(self, headers, prompt_id, **kwargs):
|
|
752
|
+
model = kwargs.get("model", "doubao-seedance-1-5-pro-251215")
|
|
753
|
+
prompt = kwargs.get("prompt", "")
|
|
754
|
+
resolution = kwargs.get("resolution", "1080p")
|
|
755
|
+
ratio = kwargs.get("ratio", "adaptive")
|
|
756
|
+
duration = kwargs.get("duration", 12)
|
|
757
|
+
camerafixed = kwargs.get("camerafixed", False)
|
|
758
|
+
generate_audio = kwargs.get("generate_audio", False)
|
|
759
|
+
seed = kwargs.get("seed", -1)
|
|
760
|
+
first_frame_image = kwargs.get("first_frame_image", None)
|
|
761
|
+
last_frame_image = kwargs.get("last_frame_image", None)
|
|
762
|
+
if first_frame_image is None:
|
|
763
|
+
raise ValueError("First frame image is required")
|
|
764
|
+
if (
|
|
765
|
+
last_frame_image is not None
|
|
766
|
+
and model == "doubao-seedance-1-0-pro-fast-251015"
|
|
767
|
+
):
|
|
768
|
+
raise ValueError(
|
|
769
|
+
"Last frame image is not supported for doubao-seedance-1-0-pro-fast-251015"
|
|
770
|
+
)
|
|
771
|
+
first_frame_image_url = self.upload_file(
|
|
772
|
+
tensor_to_bytesio(image=first_frame_image, total_pixels=4096 * 4096),
|
|
773
|
+
f"{prompt_id}_first.png",
|
|
774
|
+
headers,
|
|
775
|
+
)
|
|
776
|
+
data = {
|
|
777
|
+
"prompt": prompt,
|
|
778
|
+
"model": model,
|
|
779
|
+
"resolution": resolution,
|
|
780
|
+
"ratio": ratio,
|
|
781
|
+
"duration": duration,
|
|
782
|
+
"camerafixed": camerafixed,
|
|
783
|
+
"seed": seed,
|
|
784
|
+
"watermark": False,
|
|
785
|
+
"fps": 24,
|
|
786
|
+
"first_frame_image": first_frame_image_url,
|
|
787
|
+
"generate_audio": generate_audio,
|
|
788
|
+
}
|
|
789
|
+
if last_frame_image is not None:
|
|
790
|
+
last_frame_image_url = self.upload_file(
|
|
791
|
+
tensor_to_bytesio(image=last_frame_image, total_pixels=4096 * 4096),
|
|
792
|
+
f"{prompt_id}_last.png",
|
|
793
|
+
headers,
|
|
794
|
+
)
|
|
795
|
+
data["last_frame_image"] = last_frame_image_url
|
|
796
|
+
return data, "doubao-seedance-1-5-pro"
|
|
797
|
+
|
|
798
|
+
def handle_outputs(self, outputs):
|
|
799
|
+
return (outputs[0][0], "")
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
from bizyairsdk import tensor_to_bytesio
|
|
2
|
+
|
|
3
|
+
from .trd_nodes_base import BizyAirTrdApiBaseNode
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class TRD_VLM_API(BizyAirTrdApiBaseNode):
|
|
7
|
+
NODE_DISPLAY_NAME = "Third-Party VLM API"
|
|
8
|
+
RETURN_TYPES = (
|
|
9
|
+
"STRING",
|
|
10
|
+
"""{"gemini-3-pro-preview": "gemini-3-pro-preview", "gemini-3-flash-preview": "gemini-3-flash-preview"}""", # NOTE: 需要动态获取
|
|
11
|
+
)
|
|
12
|
+
RETURN_NAMES = ("string", "bizyair_model_name")
|
|
13
|
+
CATEGORY = "☁️BizyAir/External APIs/VLM"
|
|
14
|
+
INPUT_IS_LIST = True
|
|
15
|
+
|
|
16
|
+
@classmethod
|
|
17
|
+
def INPUT_TYPES(s):
|
|
18
|
+
return {
|
|
19
|
+
"required": {
|
|
20
|
+
"model": (
|
|
21
|
+
["gemini-3-pro-preview", "gemini-3-flash-preview"],
|
|
22
|
+
{"default": "gemini-3-flash-preview"},
|
|
23
|
+
), # NOTE: 需要动态获取
|
|
24
|
+
"system_prompt": (
|
|
25
|
+
"STRING",
|
|
26
|
+
{
|
|
27
|
+
"default": "你是一个能分析图像的AI助手。请仔细观察图像,并根据用户的问题提供详细、准确的描述。",
|
|
28
|
+
"multiline": True,
|
|
29
|
+
},
|
|
30
|
+
),
|
|
31
|
+
"user_prompt": (
|
|
32
|
+
"STRING",
|
|
33
|
+
{
|
|
34
|
+
"default": "请描述这张图片的内容,并指出任何有趣或不寻常的细节。",
|
|
35
|
+
"multiline": True,
|
|
36
|
+
},
|
|
37
|
+
),
|
|
38
|
+
"images": ("IMAGE",),
|
|
39
|
+
"max_tokens": ("INT", {"default": 32768, "min": 1, "max": 65536}),
|
|
40
|
+
"temperature": (
|
|
41
|
+
"FLOAT",
|
|
42
|
+
{"default": 1.0, "min": 0.0, "max": 2.0, "step": 0.01},
|
|
43
|
+
),
|
|
44
|
+
"detail": (
|
|
45
|
+
["low", "medium", "high"],
|
|
46
|
+
{"default": "high"},
|
|
47
|
+
),
|
|
48
|
+
"enable_thinking": (
|
|
49
|
+
"BOOLEAN",
|
|
50
|
+
{"default": False, "tooltip": "如果模型支持思考模式,是否开启"},
|
|
51
|
+
),
|
|
52
|
+
"inputcount": (
|
|
53
|
+
"INT",
|
|
54
|
+
{
|
|
55
|
+
"default": 1,
|
|
56
|
+
"min": 1,
|
|
57
|
+
"max": 900,
|
|
58
|
+
"tooltip": "动态控制输入的参考图数量,点击Update inputs按钮刷新",
|
|
59
|
+
},
|
|
60
|
+
),
|
|
61
|
+
},
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
def handle_inputs(self, headers, prompt_id, **kwargs):
|
|
65
|
+
temperature = kwargs.get("temperature", [1.0])[0]
|
|
66
|
+
max_tokens = kwargs.get("max_tokens", [32768])[0]
|
|
67
|
+
detail = kwargs.get("detail", ["high"])[0]
|
|
68
|
+
images = kwargs.get("images", [])
|
|
69
|
+
user_prompt = kwargs.get("user_prompt", [""])[0]
|
|
70
|
+
system_prompt = kwargs.get("system_prompt", [""])[0]
|
|
71
|
+
enable_thinking = kwargs.get("enable_thinking", [False])[0]
|
|
72
|
+
model = kwargs.get("model", ["gemini-3-flash-preview"])[0]
|
|
73
|
+
|
|
74
|
+
# 多图的情况可以认为图片输入都是List[Image Batch]
|
|
75
|
+
total_input_images = 0
|
|
76
|
+
for _, img_batch in enumerate(images if images is not None else []):
|
|
77
|
+
if img_batch is not None:
|
|
78
|
+
total_input_images += img_batch.shape[0]
|
|
79
|
+
extra_images, total_extra_images = self.get_extra_images(**kwargs)
|
|
80
|
+
total_input_images += total_extra_images
|
|
81
|
+
if total_input_images == 0:
|
|
82
|
+
raise ValueError("At least one image is required")
|
|
83
|
+
if total_input_images > 200:
|
|
84
|
+
raise ValueError("Maximum number of images is 200")
|
|
85
|
+
parts = []
|
|
86
|
+
index = 1
|
|
87
|
+
for _, img_batch in enumerate(images if images is not None else []):
|
|
88
|
+
for _, img in enumerate(img_batch if img_batch is not None else []):
|
|
89
|
+
if img is not None:
|
|
90
|
+
url = self.upload_file(
|
|
91
|
+
tensor_to_bytesio(image=img, total_pixels=4096 * 4096),
|
|
92
|
+
f"{prompt_id}_{index}.png",
|
|
93
|
+
headers,
|
|
94
|
+
)
|
|
95
|
+
parts.append(url)
|
|
96
|
+
index += 1
|
|
97
|
+
for _, img_batch in enumerate(extra_images):
|
|
98
|
+
for _, img in enumerate(img_batch if img_batch is not None else []):
|
|
99
|
+
if img is not None:
|
|
100
|
+
url = self.upload_file(
|
|
101
|
+
tensor_to_bytesio(image=img, total_pixels=4096 * 4096),
|
|
102
|
+
f"{prompt_id}_{index}.png",
|
|
103
|
+
headers,
|
|
104
|
+
)
|
|
105
|
+
parts.append(url)
|
|
106
|
+
index += 1
|
|
107
|
+
|
|
108
|
+
data = {
|
|
109
|
+
"urls": parts,
|
|
110
|
+
"user_prompt": user_prompt,
|
|
111
|
+
"system_prompt": system_prompt,
|
|
112
|
+
"temperature": temperature,
|
|
113
|
+
"max_tokens": max_tokens,
|
|
114
|
+
"detail": detail,
|
|
115
|
+
"enable_thinking": enable_thinking,
|
|
116
|
+
}
|
|
117
|
+
return data, model
|
|
118
|
+
|
|
119
|
+
def handle_outputs(self, outputs):
|
|
120
|
+
return (outputs[2][0], "")
|
bizyengine/core/common/client.py
CHANGED
|
@@ -250,38 +250,34 @@ async def async_send_request(
|
|
|
250
250
|
**kwargs,
|
|
251
251
|
) -> dict:
|
|
252
252
|
headers = kwargs.pop("headers") if "headers" in kwargs else _headers()
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
return {}
|
|
282
|
-
except Exception as e:
|
|
283
|
-
logging.error(f"Error fetching data: {str(e)}")
|
|
284
|
-
return {}
|
|
253
|
+
async with aiohttp.ClientSession(
|
|
254
|
+
timeout=aiohttp.ClientTimeout(total=600)
|
|
255
|
+
) as session:
|
|
256
|
+
async with session.request(
|
|
257
|
+
method, url, data=data, headers=headers, **kwargs
|
|
258
|
+
) as response:
|
|
259
|
+
response_data = await response.text()
|
|
260
|
+
logging.debug(f"Response Data: {response_data}")
|
|
261
|
+
if response.status != 200:
|
|
262
|
+
error_message = (
|
|
263
|
+
f"HTTP Status {response.status}, response body: {response_data}"
|
|
264
|
+
)
|
|
265
|
+
logging.error(f"Error encountered: {error_message}")
|
|
266
|
+
if response.status == 401:
|
|
267
|
+
raise PermissionError(
|
|
268
|
+
"Key is invalid, please refer to https://cloud.siliconflow.cn to get the API key.\n"
|
|
269
|
+
"If you have the key, please click the 'BizyAir Key' button at the bottom right to set the key."
|
|
270
|
+
)
|
|
271
|
+
else:
|
|
272
|
+
raise ConnectionError(
|
|
273
|
+
f"Failed to connect to the server: {error_message}.\n"
|
|
274
|
+
+ "Please check your API key and ensure the server is reachable.\n"
|
|
275
|
+
+ "Also, verify your network settings and disable any proxies if necessary.\n"
|
|
276
|
+
+ "After checking, please restart the ComfyUI service."
|
|
277
|
+
)
|
|
278
|
+
if callback:
|
|
279
|
+
return callback(json.loads(response_data))
|
|
280
|
+
return json.loads(response_data)
|
|
285
281
|
|
|
286
282
|
|
|
287
283
|
def fetch_models_by_type(
|
bizyengine/misc/utils.py
CHANGED
|
@@ -379,6 +379,7 @@ class SingleFlight(Generic[R]):
|
|
|
379
379
|
|
|
380
380
|
|
|
381
381
|
_MODELS_CACHE = TTLCache[str, list[str]](ttl_sec=600)
|
|
382
|
+
_TRD_MODELS_CACHE = TTLCache[str, dict](ttl_sec=600)
|
|
382
383
|
_SF = SingleFlight[None]()
|
|
383
384
|
|
|
384
385
|
|
|
@@ -421,3 +422,40 @@ def _cache_models(request_api_key: str):
|
|
|
421
422
|
]
|
|
422
423
|
_MODELS_CACHE.set("llm_models", llm_models)
|
|
423
424
|
_MODELS_CACHE.set("vlm_models", vlm_models)
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
def get_trd_models(type: str):
|
|
428
|
+
return _TRD_MODELS_CACHE.get(type)
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
def cache_trd_models(type, request_api_key: str):
|
|
432
|
+
# TODO: 效果待验证,目前节点只会被ComfyUI串行执行,所以不会出现竞争
|
|
433
|
+
# 重试最多五次
|
|
434
|
+
max_retries = 5
|
|
435
|
+
for i in range(max_retries):
|
|
436
|
+
try:
|
|
437
|
+
_, shared, e = _SF.do(
|
|
438
|
+
f"_cache_trd_models_{type}",
|
|
439
|
+
lambda: _cache_trd_models(type, request_api_key),
|
|
440
|
+
)
|
|
441
|
+
if e is not None:
|
|
442
|
+
raise e
|
|
443
|
+
return
|
|
444
|
+
except Exception:
|
|
445
|
+
logging.error(f"Failed to cache trd models on try #{i+1}")
|
|
446
|
+
if i < max_retries - 1:
|
|
447
|
+
time.sleep(5)
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
def _cache_trd_models(type, request_api_key: str):
|
|
451
|
+
# ① 开一条新线程专门跑协程 - 应该不需要在prompt那层上锁,因为并发只有1
|
|
452
|
+
with concurrent.futures.ThreadPoolExecutor(max_workers=1) as pool:
|
|
453
|
+
api_client = APIClient()
|
|
454
|
+
models, err = pool.submit(
|
|
455
|
+
asyncio.run, api_client.get_trd_nodes_by_type(type, request_api_key)
|
|
456
|
+
).result()
|
|
457
|
+
if err is not None:
|
|
458
|
+
raise err
|
|
459
|
+
if len(models) == 0:
|
|
460
|
+
raise errno.NO_MODEL_FOUND
|
|
461
|
+
_TRD_MODELS_CACHE.set(type, models)
|
bizyengine/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.2.
|
|
1
|
+
1.2.82
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bizyengine
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.82
|
|
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
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
bizyengine/__init__.py,sha256=GP9V-JM07fz7uv_qTB43QEA2rKdrVJxi5I7LRnn_3ZQ,914
|
|
2
|
-
bizyengine/version.txt,sha256=
|
|
2
|
+
bizyengine/version.txt,sha256=w2FfV7RHNEYJIt90i-7AHCD4NcjvnrJqa6fXhmf82BY,6
|
|
3
3
|
bizyengine/bizy_server/__init__.py,sha256=SP9oSblnPo4KQyh7yOGD26YCskFAcQHAZy04nQBNRIw,200
|
|
4
|
-
bizyengine/bizy_server/api_client.py,sha256=
|
|
5
|
-
bizyengine/bizy_server/errno.py,sha256=
|
|
4
|
+
bizyengine/bizy_server/api_client.py,sha256=oe06P7l8t7lgkACbqN2UdS5R-IlZIINka6eWw8YyVv4,44451
|
|
5
|
+
bizyengine/bizy_server/errno.py,sha256=Qb-V0461LAYpsMMxgLggSZxlIPPaOhhV9k1TkMfqm_U,17494
|
|
6
6
|
bizyengine/bizy_server/error_handler.py,sha256=MGrfO1AEqbfEgMWPL8B6Ypew_zHiQAdYGlhN9bZohrY,167
|
|
7
7
|
bizyengine/bizy_server/execution.py,sha256=ayaEf6eGJKQsVZV-1_UlGlvwwmlH7FEek31Uq-MbUjA,1644
|
|
8
8
|
bizyengine/bizy_server/profile.py,sha256=f4juAzJ73gCm0AhagYpt9WnG8HEI6xze_U96-omBLqU,3044
|
|
9
9
|
bizyengine/bizy_server/resp.py,sha256=iOFT5Ud7VJBP2uqkojJIgc3y2ifMjjEXoj0ewneL9lc,710
|
|
10
|
-
bizyengine/bizy_server/server.py,sha256=
|
|
10
|
+
bizyengine/bizy_server/server.py,sha256=u_CdaxrWxvPebl_N_w5lB6w6dwmkInE35e21wjJ5gQE,59817
|
|
11
11
|
bizyengine/bizy_server/stream_response.py,sha256=H2XHqlVRtQMhgdztAuG7l8-iV_Pm42u2x6WJ0gNVIW0,9654
|
|
12
12
|
bizyengine/bizy_server/utils.py,sha256=t3y3ZTDzFa8K4wXlzgLVaFNCizgylsKsd9K3rLL4sGw,3986
|
|
13
13
|
bizyengine/bizyair_extras/__init__.py,sha256=9iPmEyR7F1IXbUaBNS90ivW9ul18GcuWFxRfFv2ieAw,1011
|
|
@@ -45,8 +45,8 @@ bizyengine/bizyair_extras/nodes_ipadapter_plus/__init__.py,sha256=ECKATm_EKi_4G4
|
|
|
45
45
|
bizyengine/bizyair_extras/nodes_ipadapter_plus/nodes_ipadapter_plus.py,sha256=lOKRem7oiPs8ZkA_p68HxagAgiCSvn3Rk-L4fSXIjyE,54846
|
|
46
46
|
bizyengine/bizyair_extras/nodes_kolors_mz/__init__.py,sha256=HsCCCphW8q0SrWEiFlZKK_W2lQr1T0UJIJL7gEn37ME,3729
|
|
47
47
|
bizyengine/bizyair_extras/oauth_callback/main.py,sha256=KQOZWor3kyNx8xvUNHYNMoHfCF9g_ht13_iPk4K_5YM,3633
|
|
48
|
-
bizyengine/bizyair_extras/third_party_api/__init__.py,sha256=
|
|
49
|
-
bizyengine/bizyair_extras/third_party_api/nodes_doubao.py,sha256=
|
|
48
|
+
bizyengine/bizyair_extras/third_party_api/__init__.py,sha256=zSKsgBWaOXwKixZqDx8OSb-hhOFyYjtDVXe1vORinac,357
|
|
49
|
+
bizyengine/bizyair_extras/third_party_api/nodes_doubao.py,sha256=TrFDCRkyF6LRJ2QxRmlqiIX_ebeHI5KvKWpVfQxa3Qg,30256
|
|
50
50
|
bizyengine/bizyair_extras/third_party_api/nodes_flux.py,sha256=iv9V7-ijKGgR5_n8BlIe4E7QjWSGvWkIIUDMOn_3t1s,6339
|
|
51
51
|
bizyengine/bizyair_extras/third_party_api/nodes_gemini.py,sha256=tRjAGNJsJkYPXhlBREJd3jxPr4lF533Q_XMMHNIeXNM,17910
|
|
52
52
|
bizyengine/bizyair_extras/third_party_api/nodes_gpt.py,sha256=IwIvMiKU1h917w42NNCXM7o7VF1Bjm7hPEhwGeWGTOw,3220
|
|
@@ -55,6 +55,7 @@ bizyengine/bizyair_extras/third_party_api/nodes_kling.py,sha256=ZxQB99O7E41lA25f
|
|
|
55
55
|
bizyengine/bizyair_extras/third_party_api/nodes_sora.py,sha256=_-O37uRi5QHqJZqlJ3QzoNHYxZH4zv79-0cBYuZHer4,7132
|
|
56
56
|
bizyengine/bizyair_extras/third_party_api/nodes_veo3.py,sha256=LzZl-9iLMe5IzEAXYUVkb8RUPLAfZloTPxRgGcY7Hsg,6703
|
|
57
57
|
bizyengine/bizyair_extras/third_party_api/nodes_vidu.py,sha256=-Eo2su0-t9qNPa5J4Qt3fx8xM9NjFHmgl19gMcTU7nM,10012
|
|
58
|
+
bizyengine/bizyair_extras/third_party_api/nodes_vlm.py,sha256=WF4QysWv3IJ1S-dxlwCzf5xazqOJxtlPyg4zDal70IA,4893
|
|
58
59
|
bizyengine/bizyair_extras/third_party_api/nodes_wan_api.py,sha256=GNc616NNsXcZYtojO2XTHwU3AFiprX6tFJ7qu3s2jgc,14508
|
|
59
60
|
bizyengine/bizyair_extras/third_party_api/trd_nodes_base.py,sha256=TeT6orrXv-G8sHzR9q8HqC4hPEgsbtUOJYJpX6-aM1g,9061
|
|
60
61
|
bizyengine/bizyair_extras/utils/aliyun_oss.py,sha256=H6wGZq1DqP7BHJ_frBJVvUVttgXprJprOnxytePIuos,3050
|
|
@@ -84,7 +85,7 @@ bizyengine/core/commands/servers/model_server.py,sha256=47DEQpj8HBSa-_TImW-5JCeu
|
|
|
84
85
|
bizyengine/core/commands/servers/prompt_server.py,sha256=5R4a5EU5z5lqGNoDlGRtUGGHRojFWAtm3rdslqxpebU,11366
|
|
85
86
|
bizyengine/core/common/__init__.py,sha256=GicZw6YeAZk1PsKmFDt9dm1F75zPUlpia9Q_ki5vW1Y,179
|
|
86
87
|
bizyengine/core/common/caching.py,sha256=hRNsSrfNxgc1zzvBzLVjMY0iMkKqA0TBCr-iYhEpzik,6946
|
|
87
|
-
bizyengine/core/common/client.py,sha256=
|
|
88
|
+
bizyengine/core/common/client.py,sha256=tEkIJALKr-LWnwrstS3j04fkfGfTxVq0FUO_gOeJGGw,10455
|
|
88
89
|
bizyengine/core/common/env_var.py,sha256=1EAW3gOXY2bKouCqrGa583vTJRdDasQ1IsFTnzDg7Dk,3450
|
|
89
90
|
bizyengine/core/common/utils.py,sha256=Jxk4tCURbUhjYBFuHTiQgeUo2w13TYj4upnPTKNNucM,4215
|
|
90
91
|
bizyengine/core/configs/conf.py,sha256=D_UWG9SSJnK5EhbrfNFryJQ8hUwwdvhOGlq1TielwpI,3830
|
|
@@ -103,8 +104,8 @@ bizyengine/misc/nodes_controlnet_union_sdxl.py,sha256=fYyu_XMY7mcX1Ad9x30q1tYB8m
|
|
|
103
104
|
bizyengine/misc/route_sam.py,sha256=-bMIR2QalfnszipGxSxvDAHGJa5gPSrjkYPb5baaRg4,1561
|
|
104
105
|
bizyengine/misc/segment_anything.py,sha256=wNKYwlYPMszfwj23524geFZJjZaG4eye65SGaUnh77I,8941
|
|
105
106
|
bizyengine/misc/supernode.py,sha256=STN9gaxfTSErH8OiHeZa47d8z-G9S0I7fXuJvHQOBFM,4532
|
|
106
|
-
bizyengine/misc/utils.py,sha256=
|
|
107
|
-
bizyengine-1.2.
|
|
108
|
-
bizyengine-1.2.
|
|
109
|
-
bizyengine-1.2.
|
|
110
|
-
bizyengine-1.2.
|
|
107
|
+
bizyengine/misc/utils.py,sha256=JJqlabu0-wU8WEglaQWRPIYDOPX7qnWTyTZeJAaORns,14654
|
|
108
|
+
bizyengine-1.2.82.dist-info/METADATA,sha256=5vQwTzdxix3GEyQ2YeNqUhneIjTKa8xcaPIZMDeUO3A,735
|
|
109
|
+
bizyengine-1.2.82.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
110
|
+
bizyengine-1.2.82.dist-info/top_level.txt,sha256=2zapzqxX-we5cRyJkGf9bd5JinRtXp3-_uDI-xCAnc0,11
|
|
111
|
+
bizyengine-1.2.82.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|