bizyengine 1.1.2__py3-none-any.whl → 1.2.1__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 +349 -42
- bizyengine/bizy_server/errno.py +410 -88
- bizyengine/bizy_server/profile.py +90 -0
- bizyengine/bizy_server/resp.py +8 -4
- bizyengine/bizy_server/server.py +194 -1
- bizyengine/bizy_server/utils.py +11 -0
- bizyengine/bizyair_extras/nodes_comfyui_instantid.py +11 -0
- bizyengine/bizyair_extras/nodes_comfyui_pulid_flux.py +15 -0
- bizyengine/bizyair_extras/nodes_ipadapter_plus/nodes_ipadapter_plus.py +39 -0
- bizyengine/bizyair_extras/nodes_kolors_mz/__init__.py +41 -1
- bizyengine/bizyair_extras/nodes_upscale_model.py +11 -0
- bizyengine/core/commands/processors/prompt_processor.py +14 -7
- bizyengine/core/common/client.py +22 -8
- bizyengine/core/common/env_var.py +7 -4
- bizyengine/core/configs/models.yaml +11 -0
- bizyengine/core/nodes_base.py +20 -1
- bizyengine/core/path_utils/path_manager.py +62 -9
- bizyengine/misc/nodes.py +219 -3
- bizyengine/misc/supernode.py +0 -36
- bizyengine/version.txt +1 -1
- {bizyengine-1.1.2.dist-info → bizyengine-1.2.1.dist-info}/METADATA +2 -2
- {bizyengine-1.1.2.dist-info → bizyengine-1.2.1.dist-info}/RECORD +24 -23
- {bizyengine-1.1.2.dist-info → bizyengine-1.2.1.dist-info}/WHEEL +1 -1
- {bizyengine-1.1.2.dist-info → bizyengine-1.2.1.dist-info}/top_level.txt +0 -0
bizyengine/bizy_server/server.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import asyncio
|
|
2
|
-
import
|
|
2
|
+
import configparser
|
|
3
3
|
import logging
|
|
4
|
+
import os
|
|
5
|
+
import shutil
|
|
4
6
|
import threading
|
|
5
7
|
import time
|
|
6
8
|
import urllib.parse
|
|
@@ -12,6 +14,7 @@ from server import PromptServer
|
|
|
12
14
|
from .api_client import APIClient
|
|
13
15
|
from .errno import ErrorNo, errnos
|
|
14
16
|
from .error_handler import ErrorHandler
|
|
17
|
+
from .profile import user_profile
|
|
15
18
|
from .resp import ErrResponse, OKResponse
|
|
16
19
|
from .utils import base_model_types, check_str_param, check_type, is_string_valid, types
|
|
17
20
|
|
|
@@ -19,6 +22,7 @@ API_PREFIX = "bizyair"
|
|
|
19
22
|
COMMUNITY_API = f"{API_PREFIX}/community"
|
|
20
23
|
MODEL_HOST_API = f"{API_PREFIX}/modelhost"
|
|
21
24
|
USER_API = f"{API_PREFIX}/user"
|
|
25
|
+
INVOICE_API = f"{API_PREFIX}/invoices"
|
|
22
26
|
|
|
23
27
|
logging.basicConfig(level=logging.DEBUG)
|
|
24
28
|
|
|
@@ -764,6 +768,195 @@ class BizyAirServer:
|
|
|
764
768
|
return ErrResponse(err)
|
|
765
769
|
return OKResponse(resp)
|
|
766
770
|
|
|
771
|
+
@self.prompt_server.routes.get(f"/{USER_API}/wallet")
|
|
772
|
+
async def get_wallet(request):
|
|
773
|
+
# 获取用户钱包信息
|
|
774
|
+
resp, err = await self.api_client.get_wallet()
|
|
775
|
+
if err:
|
|
776
|
+
return ErrResponse(err)
|
|
777
|
+
return OKResponse(resp)
|
|
778
|
+
|
|
779
|
+
@self.prompt_server.routes.get(f"/{USER_API}/coins")
|
|
780
|
+
async def query_coins(request):
|
|
781
|
+
# 获取用户金币记录
|
|
782
|
+
current = int(request.rel_url.query.get("current", "1"))
|
|
783
|
+
page_size = int(request.rel_url.query.get("page_size", "10"))
|
|
784
|
+
coin_type = int(request.rel_url.query.get("coin_type", "0"))
|
|
785
|
+
expire_days = int(request.rel_url.query.get("expire_days", "0"))
|
|
786
|
+
|
|
787
|
+
resp, err = await self.api_client.query_coins(
|
|
788
|
+
current, page_size, coin_type, expire_days
|
|
789
|
+
)
|
|
790
|
+
if err:
|
|
791
|
+
return ErrResponse(err)
|
|
792
|
+
return OKResponse(resp)
|
|
793
|
+
|
|
794
|
+
@self.prompt_server.routes.get(f"/{USER_API}/metadata")
|
|
795
|
+
async def get_user_metadata(request):
|
|
796
|
+
# 获取用户元数据
|
|
797
|
+
resp, err = await self.api_client.get_user_metadata()
|
|
798
|
+
if err:
|
|
799
|
+
return ErrResponse(err)
|
|
800
|
+
return OKResponse(resp)
|
|
801
|
+
|
|
802
|
+
@self.prompt_server.routes.put(f"/{USER_API}/metadata")
|
|
803
|
+
async def update_user_info(request):
|
|
804
|
+
# 更新用户信息
|
|
805
|
+
json_data = await request.json()
|
|
806
|
+
name = json_data.get("name")
|
|
807
|
+
avatar = json_data.get("avatar")
|
|
808
|
+
introduction = json_data.get("introduction")
|
|
809
|
+
|
|
810
|
+
resp, err = await self.api_client.update_user_info(
|
|
811
|
+
name, avatar, introduction
|
|
812
|
+
)
|
|
813
|
+
if err:
|
|
814
|
+
return ErrResponse(err)
|
|
815
|
+
return OKResponse(resp)
|
|
816
|
+
|
|
817
|
+
@self.prompt_server.routes.post(f"/{USER_API}/real_name")
|
|
818
|
+
async def user_real_name(request):
|
|
819
|
+
# 实名认证
|
|
820
|
+
resp, err = await self.api_client.user_real_name()
|
|
821
|
+
if err:
|
|
822
|
+
return ErrResponse(err)
|
|
823
|
+
return OKResponse(resp)
|
|
824
|
+
|
|
825
|
+
@self.prompt_server.routes.get(f"/{USER_API}/language")
|
|
826
|
+
async def get_user_profile(request):
|
|
827
|
+
return OKResponse(user_profile.getLang())
|
|
828
|
+
|
|
829
|
+
@self.prompt_server.routes.get(f"/{USER_API}/profile")
|
|
830
|
+
async def get_user_profile(request):
|
|
831
|
+
return OKResponse(user_profile.getAll())
|
|
832
|
+
|
|
833
|
+
@self.prompt_server.routes.put(f"/{USER_API}/profile")
|
|
834
|
+
async def update_user_profile(request):
|
|
835
|
+
# 更新用户本地配置
|
|
836
|
+
json_data = await request.json()
|
|
837
|
+
|
|
838
|
+
err = user_profile.update_profile(json_data)
|
|
839
|
+
if err is not None:
|
|
840
|
+
return ErrResponse(err)
|
|
841
|
+
return OKResponse({})
|
|
842
|
+
|
|
843
|
+
@self.prompt_server.routes.get(f"/{USER_API}/products")
|
|
844
|
+
async def list_products(request):
|
|
845
|
+
# 获取产品列表
|
|
846
|
+
resp, err = await self.api_client.list_products()
|
|
847
|
+
if err:
|
|
848
|
+
return ErrResponse(err)
|
|
849
|
+
return OKResponse(resp)
|
|
850
|
+
|
|
851
|
+
@self.prompt_server.routes.get(f"/{USER_API}/pay/page")
|
|
852
|
+
async def list_pay_orders(request):
|
|
853
|
+
# 获取订单列表
|
|
854
|
+
current = int(request.rel_url.query.get("current", "1"))
|
|
855
|
+
page_size = int(request.rel_url.query.get("page_size", "10"))
|
|
856
|
+
status = request.rel_url.query.get("status", None)
|
|
857
|
+
resp, err = await self.api_client.list_pay_orders(
|
|
858
|
+
current, page_size, status
|
|
859
|
+
)
|
|
860
|
+
if err:
|
|
861
|
+
return ErrResponse(err)
|
|
862
|
+
return OKResponse(resp)
|
|
863
|
+
|
|
864
|
+
@self.prompt_server.routes.post(f"/{USER_API}/buy")
|
|
865
|
+
async def buy_product(request):
|
|
866
|
+
# 购买商品
|
|
867
|
+
json_data = await request.json()
|
|
868
|
+
|
|
869
|
+
if "product_id" not in json_data:
|
|
870
|
+
return ErrResponse(errnos.INVALID_PRODUCT_ID)
|
|
871
|
+
product_id = json_data.get("product_id")
|
|
872
|
+
|
|
873
|
+
if "platform" not in json_data:
|
|
874
|
+
return ErrResponse(errnos.INVALID_PAY_PLATFORM)
|
|
875
|
+
platform = json_data.get("platform")
|
|
876
|
+
|
|
877
|
+
resp, err = await self.api_client.buy_product(product_id, platform)
|
|
878
|
+
if err:
|
|
879
|
+
return ErrResponse(err)
|
|
880
|
+
return OKResponse(resp)
|
|
881
|
+
|
|
882
|
+
@self.prompt_server.routes.get(f"/{USER_API}/pay/orders")
|
|
883
|
+
async def list_pay_orders(request):
|
|
884
|
+
# 获取支付订单状态
|
|
885
|
+
order_no = request.rel_url.query.get("order_no", None)
|
|
886
|
+
if order_no == None:
|
|
887
|
+
return ErrResponse(errnos.INVALID_ORDER_NO)
|
|
888
|
+
resp, err = await self.api_client.get_pay_status(order_no)
|
|
889
|
+
if err:
|
|
890
|
+
return ErrResponse(err)
|
|
891
|
+
return OKResponse(resp)
|
|
892
|
+
|
|
893
|
+
@self.prompt_server.routes.delete(f"/{USER_API}/pay/orders")
|
|
894
|
+
async def cancel_pay_order(request):
|
|
895
|
+
# 取消支付订单
|
|
896
|
+
json_data = await request.json()
|
|
897
|
+
if "order_no" not in json_data:
|
|
898
|
+
return ErrResponse(errnos.INVALID_ORDER_NO)
|
|
899
|
+
order_no = json_data.get("order_no")
|
|
900
|
+
resp, err = await self.api_client.cancel_pay_order(order_no)
|
|
901
|
+
if err:
|
|
902
|
+
return ErrResponse(err)
|
|
903
|
+
return OKResponse(resp)
|
|
904
|
+
|
|
905
|
+
@self.prompt_server.routes.get(f"/{INVOICE_API}/year_cost")
|
|
906
|
+
async def get_year_cost(request):
|
|
907
|
+
year = request.rel_url.query.get("year", "")
|
|
908
|
+
api_key = request.rel_url.query.get("api_key", "")
|
|
909
|
+
|
|
910
|
+
if not year:
|
|
911
|
+
return ErrResponse(errnos.INVALID_YEAR_PARAM)
|
|
912
|
+
|
|
913
|
+
resp, err = await self.api_client.get_year_cost(year=year, api_key=api_key)
|
|
914
|
+
if err is not None:
|
|
915
|
+
return ErrResponse(err)
|
|
916
|
+
|
|
917
|
+
return OKResponse(resp)
|
|
918
|
+
|
|
919
|
+
@self.prompt_server.routes.get(f"/{INVOICE_API}/month_cost")
|
|
920
|
+
async def get_month_cost(request):
|
|
921
|
+
month = request.rel_url.query.get("month", "")
|
|
922
|
+
api_key = request.rel_url.query.get("api_key", "")
|
|
923
|
+
|
|
924
|
+
if not month:
|
|
925
|
+
return ErrResponse(errnos.INVALID_MONTH_PARAM)
|
|
926
|
+
|
|
927
|
+
resp, err = await self.api_client.get_month_cost(
|
|
928
|
+
month=month, api_key=api_key
|
|
929
|
+
)
|
|
930
|
+
if err is not None:
|
|
931
|
+
return ErrResponse(err)
|
|
932
|
+
|
|
933
|
+
return OKResponse(resp)
|
|
934
|
+
|
|
935
|
+
@self.prompt_server.routes.get(f"/{INVOICE_API}/day_cost")
|
|
936
|
+
async def get_day_cost(request):
|
|
937
|
+
day = request.rel_url.query.get("day", "")
|
|
938
|
+
api_key = request.rel_url.query.get("api_key", "")
|
|
939
|
+
|
|
940
|
+
if not day:
|
|
941
|
+
return ErrResponse(errnos.INVALID_DAY_PARAM)
|
|
942
|
+
|
|
943
|
+
resp, err = await self.api_client.get_day_cost(day=day, api_key=api_key)
|
|
944
|
+
if err is not None:
|
|
945
|
+
return ErrResponse(err)
|
|
946
|
+
|
|
947
|
+
return OKResponse(resp)
|
|
948
|
+
|
|
949
|
+
@self.prompt_server.routes.get(f"/{INVOICE_API}/recent_cost")
|
|
950
|
+
async def get_recent_cost(request):
|
|
951
|
+
|
|
952
|
+
api_key = request.rel_url.query.get("api_key", "")
|
|
953
|
+
|
|
954
|
+
resp, err = await self.api_client.get_recent_cost(api_key=api_key)
|
|
955
|
+
if err is not None:
|
|
956
|
+
return ErrResponse(err)
|
|
957
|
+
|
|
958
|
+
return OKResponse(resp)
|
|
959
|
+
|
|
767
960
|
async def send_json(self, event, data, sid=None):
|
|
768
961
|
message = {"type": event, "data": data}
|
|
769
962
|
|
bizyengine/bizy_server/utils.py
CHANGED
|
@@ -7,6 +7,15 @@ from .resp import ErrResponse
|
|
|
7
7
|
TYPE_OPTIONS = {
|
|
8
8
|
"LoRA": "LoRA",
|
|
9
9
|
"Controlnet": "Controlnet",
|
|
10
|
+
"Checkpoint": "Checkpoint",
|
|
11
|
+
# "Clip": "Clip",
|
|
12
|
+
# "Ipadapter": "Ipadapter",
|
|
13
|
+
# "Unet": "Unet",
|
|
14
|
+
# "Vae": "Vae",
|
|
15
|
+
# "Upscale_models": "Upscale_models",
|
|
16
|
+
# "Instantid": "Instantid",
|
|
17
|
+
# "Pulid": "Pulid",
|
|
18
|
+
# "Style_models": "Style_models",
|
|
10
19
|
}
|
|
11
20
|
|
|
12
21
|
BASE_MODEL_TYPE_OPTIONS = {
|
|
@@ -17,6 +26,8 @@ BASE_MODEL_TYPE_OPTIONS = {
|
|
|
17
26
|
"Pony": "Pony",
|
|
18
27
|
"Kolors": "Kolors",
|
|
19
28
|
"Hunyuan 1": "Hunyuan 1",
|
|
29
|
+
"Hunyuan Video": "Hunyuan Video",
|
|
30
|
+
"Wan Video": "Wan Video",
|
|
20
31
|
"Other": "Other",
|
|
21
32
|
}
|
|
22
33
|
|
|
@@ -8,6 +8,17 @@ class InstantIDModelLoader(BizyAirBaseNode):
|
|
|
8
8
|
return {
|
|
9
9
|
"required": {
|
|
10
10
|
"instantid_file": (folder_paths.get_filename_list("instantid"),)
|
|
11
|
+
# "instantid_file": (
|
|
12
|
+
# [
|
|
13
|
+
# "to choose",
|
|
14
|
+
# ],
|
|
15
|
+
# ),
|
|
16
|
+
# "model_version_id": (
|
|
17
|
+
# "STRING",
|
|
18
|
+
# {
|
|
19
|
+
# "default": "",
|
|
20
|
+
# },
|
|
21
|
+
# ),
|
|
11
22
|
}
|
|
12
23
|
}
|
|
13
24
|
|
|
@@ -11,6 +11,21 @@ class PulidFluxModelLoader(BizyAirBaseNode):
|
|
|
11
11
|
@classmethod
|
|
12
12
|
def INPUT_TYPES(s):
|
|
13
13
|
return {"required": {"pulid_file": (folder_paths.get_filename_list("pulid"),)}}
|
|
14
|
+
# return {
|
|
15
|
+
# "required": {
|
|
16
|
+
# "pulid_file": (
|
|
17
|
+
# [
|
|
18
|
+
# "to choose",
|
|
19
|
+
# ],
|
|
20
|
+
# ),
|
|
21
|
+
# "model_version_id": (
|
|
22
|
+
# "STRING",
|
|
23
|
+
# {
|
|
24
|
+
# "default": "",
|
|
25
|
+
# },
|
|
26
|
+
# ),
|
|
27
|
+
# }
|
|
28
|
+
# }
|
|
14
29
|
|
|
15
30
|
RETURN_TYPES = (PULIDFLUX,)
|
|
16
31
|
RETURN_NAMES = ("pulid_flux",)
|
|
@@ -4,6 +4,7 @@ import os
|
|
|
4
4
|
import folder_paths
|
|
5
5
|
import torch
|
|
6
6
|
from bizyengine.core import BizyAirBaseNode, BizyAirNodeIO, create_node_data
|
|
7
|
+
from bizyengine.core.configs.conf import config_manager
|
|
7
8
|
from bizyengine.core.data_types import CLIP, CONDITIONING, MODEL
|
|
8
9
|
|
|
9
10
|
# set the models directory
|
|
@@ -160,6 +161,19 @@ class IPAdapterModelLoader(BizyAirBaseNode):
|
|
|
160
161
|
def INPUT_TYPES(s):
|
|
161
162
|
return {
|
|
162
163
|
"required": {"ipadapter_file": (["kolors/ip_adapter_plus_general.bin"],)}
|
|
164
|
+
# "required": {
|
|
165
|
+
# "ipadapter_file": (
|
|
166
|
+
# [
|
|
167
|
+
# "to choose",
|
|
168
|
+
# ],
|
|
169
|
+
# ),
|
|
170
|
+
# "model_version_id": (
|
|
171
|
+
# "STRING",
|
|
172
|
+
# {
|
|
173
|
+
# "default": "",
|
|
174
|
+
# },
|
|
175
|
+
# ),
|
|
176
|
+
# }
|
|
163
177
|
}
|
|
164
178
|
|
|
165
179
|
RETURN_TYPES = ("IPADAPTER",)
|
|
@@ -174,6 +188,31 @@ class IPAdapterModelLoader(BizyAirBaseNode):
|
|
|
174
188
|
)
|
|
175
189
|
return (BizyAirNodeIO(self.assigned_id, nodes={self.assigned_id: node_data}),)
|
|
176
190
|
|
|
191
|
+
# @classmethod
|
|
192
|
+
# def VALIDATE_INPUTS(cls, ipadapter_file):
|
|
193
|
+
# # TODO
|
|
194
|
+
# import warnings
|
|
195
|
+
|
|
196
|
+
# warnings.warn(message=f"TODO fix {cls}VALIDATE_INPUTS")
|
|
197
|
+
# if ipadapter_file == "" or ipadapter_file is None:
|
|
198
|
+
# return False
|
|
199
|
+
# return True
|
|
200
|
+
|
|
201
|
+
# def load_ipadapter_model(self, **kwargs):
|
|
202
|
+
# model_version_id = kwargs.get("model_version_id", "")
|
|
203
|
+
# if model_version_id != "":
|
|
204
|
+
# # use model version id as lora name
|
|
205
|
+
# ipadapter_file = (
|
|
206
|
+
# f"{config_manager.get_model_version_id_prefix()}{model_version_id}"
|
|
207
|
+
# )
|
|
208
|
+
# kwargs["ipadapter_file"] = ipadapter_file
|
|
209
|
+
# node_data = create_node_data(
|
|
210
|
+
# class_type="IPAdapterModelLoader",
|
|
211
|
+
# inputs=kwargs,
|
|
212
|
+
# outputs={"slot_index": 0},
|
|
213
|
+
# )
|
|
214
|
+
# return (BizyAirNodeIO(self.assigned_id, nodes={self.assigned_id: node_data}),)
|
|
215
|
+
|
|
177
216
|
|
|
178
217
|
# class IPAdapterInsightFaceLoader:
|
|
179
218
|
# @classmethod
|
|
@@ -2,6 +2,7 @@ import os
|
|
|
2
2
|
|
|
3
3
|
from bizyengine.core import BizyAirBaseNode, BizyAirNodeIO, create_node_data
|
|
4
4
|
from bizyengine.core import path_utils as folder_paths
|
|
5
|
+
from bizyengine.core.configs.conf import config_manager
|
|
5
6
|
from bizyengine.core.data_types import CLIP, CONDITIONING, CONTROL_NET, MODEL
|
|
6
7
|
|
|
7
8
|
AUTHOR_NAME = "MinusZone"
|
|
@@ -14,6 +15,17 @@ class MZ_KolorsUNETLoaderV2(BizyAirBaseNode):
|
|
|
14
15
|
return {
|
|
15
16
|
"required": {
|
|
16
17
|
"unet_name": (folder_paths.get_filename_list("unet"),),
|
|
18
|
+
# "unet_name": (
|
|
19
|
+
# [
|
|
20
|
+
# "to choose",
|
|
21
|
+
# ],
|
|
22
|
+
# ),
|
|
23
|
+
# "model_version_id": (
|
|
24
|
+
# "STRING",
|
|
25
|
+
# {
|
|
26
|
+
# "default": "",
|
|
27
|
+
# },
|
|
28
|
+
# ),
|
|
17
29
|
}
|
|
18
30
|
}
|
|
19
31
|
|
|
@@ -26,7 +38,6 @@ class MZ_KolorsUNETLoaderV2(BizyAirBaseNode):
|
|
|
26
38
|
NODE_DISPLAY_NAME = f"{AUTHOR_NAME} - KolorsUNETLoaderV2"
|
|
27
39
|
|
|
28
40
|
def load_unet(self, **kwargs):
|
|
29
|
-
|
|
30
41
|
node_data = create_node_data(
|
|
31
42
|
class_type="MZ_KolorsUNETLoaderV2",
|
|
32
43
|
inputs=kwargs,
|
|
@@ -38,6 +49,35 @@ class MZ_KolorsUNETLoaderV2(BizyAirBaseNode):
|
|
|
38
49
|
)
|
|
39
50
|
return (out,)
|
|
40
51
|
|
|
52
|
+
# @classmethod
|
|
53
|
+
# def VALIDATE_INPUTS(cls, unet_name):
|
|
54
|
+
# # TODO
|
|
55
|
+
# import warnings
|
|
56
|
+
|
|
57
|
+
# warnings.warn(message=f"TODO fix {cls}VALIDATE_INPUTS")
|
|
58
|
+
# if unet_name == "" or unet_name is None:
|
|
59
|
+
# return False
|
|
60
|
+
# return True
|
|
61
|
+
|
|
62
|
+
# def load_unet(self, **kwargs):
|
|
63
|
+
# model_version_id = kwargs.get("model_version_id", "")
|
|
64
|
+
# if model_version_id != "":
|
|
65
|
+
# # use model version id as lora name
|
|
66
|
+
# unet_name = (
|
|
67
|
+
# f"{config_manager.get_model_version_id_prefix()}{model_version_id}"
|
|
68
|
+
# )
|
|
69
|
+
# kwargs["unet_name"] = unet_name
|
|
70
|
+
# node_data = create_node_data(
|
|
71
|
+
# class_type="MZ_KolorsUNETLoaderV2",
|
|
72
|
+
# inputs=kwargs,
|
|
73
|
+
# outputs={"slot_index": 0},
|
|
74
|
+
# )
|
|
75
|
+
# config_file = folder_paths.guess_config(unet_name=kwargs["unet_name"])
|
|
76
|
+
# out = BizyAirNodeIO(
|
|
77
|
+
# self.assigned_id, {self.assigned_id: node_data}, config_file=config_file
|
|
78
|
+
# )
|
|
79
|
+
# return (out,)
|
|
80
|
+
|
|
41
81
|
|
|
42
82
|
WEIGHT_TYPES = [
|
|
43
83
|
"linear",
|
|
@@ -9,6 +9,17 @@ class UpscaleModelLoader(BizyAirBaseNode):
|
|
|
9
9
|
return {
|
|
10
10
|
"required": {
|
|
11
11
|
"model_name": (folder_paths.get_filename_list("upscale_models"),),
|
|
12
|
+
# "model_name": (
|
|
13
|
+
# [
|
|
14
|
+
# "to choose",
|
|
15
|
+
# ],
|
|
16
|
+
# ),
|
|
17
|
+
# "model_version_id": (
|
|
18
|
+
# "STRING",
|
|
19
|
+
# {
|
|
20
|
+
# "default": "",
|
|
21
|
+
# },
|
|
22
|
+
# ),
|
|
12
23
|
}
|
|
13
24
|
}
|
|
14
25
|
|
|
@@ -15,6 +15,7 @@ from bizyengine.core.path_utils import (
|
|
|
15
15
|
convert_prompt_label_path_to_real_path,
|
|
16
16
|
guess_url_from_node,
|
|
17
17
|
)
|
|
18
|
+
from server import PromptServer
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
def is_link(obj):
|
|
@@ -106,15 +107,21 @@ class PromptProcessor(Processor):
|
|
|
106
107
|
def process(
|
|
107
108
|
self, url: str, prompt: Dict[str, Dict[str, Any]], last_node_ids: List[str]
|
|
108
109
|
):
|
|
110
|
+
dict = {
|
|
111
|
+
"prompt": prompt,
|
|
112
|
+
"last_node_id": last_node_ids[0],
|
|
113
|
+
"exec_info": self._exec_info(prompt),
|
|
114
|
+
}
|
|
115
|
+
if (
|
|
116
|
+
PromptServer.instance is not None
|
|
117
|
+
and PromptServer.instance.last_prompt_id is not None
|
|
118
|
+
):
|
|
119
|
+
dict["prompt_id"] = PromptServer.instance.last_prompt_id
|
|
120
|
+
print("Processing prompt with ID: " + PromptServer.instance.last_prompt_id)
|
|
121
|
+
|
|
109
122
|
return client.send_request(
|
|
110
123
|
url=url,
|
|
111
|
-
data=json.dumps(
|
|
112
|
-
{
|
|
113
|
-
"prompt": prompt,
|
|
114
|
-
"last_node_id": last_node_ids[0],
|
|
115
|
-
"exec_info": self._exec_info(prompt),
|
|
116
|
-
}
|
|
117
|
-
).encode("utf-8"),
|
|
124
|
+
data=json.dumps(dict).encode("utf-8"),
|
|
118
125
|
)
|
|
119
126
|
|
|
120
127
|
def validate_input(
|
bizyengine/core/common/client.py
CHANGED
|
@@ -21,6 +21,10 @@ from .env_var import BIZYAIR_API_KEY, BIZYAIR_DEBUG, BIZYAIR_SERVER_ADDRESS
|
|
|
21
21
|
|
|
22
22
|
IS_API_KEY_VALID = None
|
|
23
23
|
|
|
24
|
+
version_path = os.path.join(os.path.dirname(__file__), "..", "..", "version.txt")
|
|
25
|
+
with open(version_path, "r") as file:
|
|
26
|
+
CLIENT_VERSION = file.read().strip()
|
|
27
|
+
|
|
24
28
|
|
|
25
29
|
@dataclass
|
|
26
30
|
class APIKeyState:
|
|
@@ -126,6 +130,7 @@ def send_request(
|
|
|
126
130
|
try:
|
|
127
131
|
headers = kwargs.pop("headers") if "headers" in kwargs else _headers()
|
|
128
132
|
headers["User-Agent"] = "BizyAir Client"
|
|
133
|
+
headers["x-bizyair-client-version"] = CLIENT_VERSION
|
|
129
134
|
|
|
130
135
|
req = urllib.request.Request(
|
|
131
136
|
url, data=data, headers=headers, method=method, **kwargs
|
|
@@ -155,14 +160,23 @@ def send_request(
|
|
|
155
160
|
"If you have the key, please click the 'API Key' button at the bottom right to set the key."
|
|
156
161
|
)
|
|
157
162
|
elif code != "N/A" and message != "N/A":
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
163
|
+
if code in [20049, 20050]:
|
|
164
|
+
raise ConnectionError(
|
|
165
|
+
f"""Failed to handle your request:
|
|
166
|
+
|
|
167
|
+
{message}"""
|
|
168
|
+
)
|
|
169
|
+
else:
|
|
170
|
+
raise ConnectionError(
|
|
171
|
+
f"""Failed to handle your request: {error_message}
|
|
172
|
+
|
|
173
|
+
Error code: {code}
|
|
174
|
+
Error message: {message}
|
|
175
|
+
|
|
176
|
+
The cause of this issue may be incorrect parameter status or ongoing background tasks.
|
|
177
|
+
If retrying after waiting for a while still does not resolve the issue,
|
|
178
|
+
please report it to Bizyair's official support."""
|
|
179
|
+
)
|
|
166
180
|
else:
|
|
167
181
|
common_sites = [
|
|
168
182
|
"https://www.baidu.com",
|
|
@@ -87,10 +87,13 @@ def create_api_key_file(api_key):
|
|
|
87
87
|
# service_address: https://bizyair-api.siliconflow.cn/x/v1
|
|
88
88
|
# uat:
|
|
89
89
|
# service_address: https://uat-bizyair-api.siliconflow.cn/x/v1
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
_BIZYAIR_DOMAIN = os.getenv("BIZYAIR_DOMAIN", "https://api.bizyair.cn")
|
|
91
|
+
BIZYAIR_DOMAIN = ServerAddress(_BIZYAIR_DOMAIN)
|
|
92
|
+
BIZYAIR_X_SERVER = f"{_BIZYAIR_DOMAIN}/x/v1"
|
|
93
|
+
BIZYAIR_Y_SERVER = f"{_BIZYAIR_DOMAIN}/y/v1"
|
|
94
|
+
|
|
95
|
+
BIZYAIR_SERVER_ADDRESS = ServerAddress(BIZYAIR_X_SERVER)
|
|
96
|
+
|
|
94
97
|
BIZYAIR_API_KEY = env("BIZYAIR_API_KEY", str, load_api_key()[1])
|
|
95
98
|
# Development Settings
|
|
96
99
|
BIZYAIR_DEV_REQUEST_URL = env("BIZYAIR_DEV_REQUEST_URL", str, None)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Common configuration
|
|
2
2
|
model_version_config:
|
|
3
3
|
model_version_id_prefix: "BIZYAIR_MODEL_VERSION_ID:"
|
|
4
|
+
detect_model_type:
|
|
5
|
+
url: "todo"
|
|
4
6
|
|
|
5
7
|
cache_config:
|
|
6
8
|
max_size: 100 # 100 items
|
|
@@ -93,6 +95,8 @@ model_rules:
|
|
|
93
95
|
inputs:
|
|
94
96
|
ckpt_name:
|
|
95
97
|
- ^sd3.5_large.safetensors$
|
|
98
|
+
- action: detect_model
|
|
99
|
+
detection_type: ckpt
|
|
96
100
|
|
|
97
101
|
- mode_type: checkpoint
|
|
98
102
|
base_model: SD3
|
|
@@ -104,6 +108,8 @@ model_rules:
|
|
|
104
108
|
inputs:
|
|
105
109
|
ckpt_name:
|
|
106
110
|
- ^sd3.5_large_turbo.safetensors$
|
|
111
|
+
- action: detect_model
|
|
112
|
+
detection_type: ckpt
|
|
107
113
|
|
|
108
114
|
- mode_type: checkpoint
|
|
109
115
|
base_model: BaseModel
|
|
@@ -115,6 +121,8 @@ model_rules:
|
|
|
115
121
|
inputs:
|
|
116
122
|
ckpt_name:
|
|
117
123
|
- ^sd15/dreamshaper_8.safetensors$
|
|
124
|
+
- action: detect_model
|
|
125
|
+
detection_type: ckpt
|
|
118
126
|
|
|
119
127
|
|
|
120
128
|
- mode_type: checkpoint
|
|
@@ -127,6 +135,9 @@ model_rules:
|
|
|
127
135
|
inputs:
|
|
128
136
|
ckpt_name:
|
|
129
137
|
- ^sdxl.*
|
|
138
|
+
- action: detect_model
|
|
139
|
+
detection_type: ckpt
|
|
140
|
+
|
|
130
141
|
|
|
131
142
|
- mode_type: checkpoint
|
|
132
143
|
base_model: SDXL
|
bizyengine/core/nodes_base.py
CHANGED
|
@@ -4,6 +4,8 @@ import warnings
|
|
|
4
4
|
from functools import wraps
|
|
5
5
|
from typing import List
|
|
6
6
|
|
|
7
|
+
from bizyengine.core.configs.conf import config_manager
|
|
8
|
+
|
|
7
9
|
from .data_types import is_send_request_datatype
|
|
8
10
|
from .nodes_io import BizyAirNodeIO, create_node_data
|
|
9
11
|
|
|
@@ -22,6 +24,23 @@ NODE_CLASS_MAPPINGS = {}
|
|
|
22
24
|
NODE_DISPLAY_NAME_MAPPINGS = {}
|
|
23
25
|
|
|
24
26
|
|
|
27
|
+
def process_kwargs(kwargs):
|
|
28
|
+
possibleWidgetNames = [
|
|
29
|
+
"model_name",
|
|
30
|
+
"instantid_file",
|
|
31
|
+
"pulid_file",
|
|
32
|
+
"style_model_name",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
model_version_id = kwargs.get("model_version_id", "")
|
|
36
|
+
if model_version_id:
|
|
37
|
+
name = f"{config_manager.get_model_version_id_prefix()}{model_version_id}"
|
|
38
|
+
for key in possibleWidgetNames:
|
|
39
|
+
if key in kwargs:
|
|
40
|
+
kwargs[key] = name
|
|
41
|
+
return kwargs
|
|
42
|
+
|
|
43
|
+
|
|
25
44
|
def to_camel_case(s):
|
|
26
45
|
return "".join(word.capitalize() for word in s.split("_"))
|
|
27
46
|
|
|
@@ -122,7 +141,7 @@ class BizyAirBaseNode:
|
|
|
122
141
|
|
|
123
142
|
def default_function(self, **kwargs):
|
|
124
143
|
class_type = self._determine_class_type()
|
|
125
|
-
|
|
144
|
+
kwargs = process_kwargs(kwargs)
|
|
126
145
|
node_ios = self._process_non_send_request_types(class_type, kwargs)
|
|
127
146
|
# TODO: add processing for send_request_types
|
|
128
147
|
send_request_datatype_list = self._get_send_request_datatypes()
|