bizyengine 1.2.32__py3-none-any.whl → 1.2.33__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/errno.py +14 -1
- bizyengine/bizy_server/server.py +21 -2
- bizyengine/bizy_server/utils.py +9 -2
- bizyengine/version.txt +1 -1
- {bizyengine-1.2.32.dist-info → bizyengine-1.2.33.dist-info}/METADATA +1 -1
- {bizyengine-1.2.32.dist-info → bizyengine-1.2.33.dist-info}/RECORD +8 -8
- {bizyengine-1.2.32.dist-info → bizyengine-1.2.33.dist-info}/WHEEL +0 -0
- {bizyengine-1.2.32.dist-info → bizyengine-1.2.33.dist-info}/top_level.txt +0 -0
bizyengine/bizy_server/errno.py
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import copy
|
|
2
|
+
|
|
3
|
+
|
|
1
4
|
class ErrorNo:
|
|
2
5
|
def __init__(self, http_status_code, code, payload, messages):
|
|
3
6
|
self.http_status_code = http_status_code
|
|
@@ -6,11 +9,21 @@ class ErrorNo:
|
|
|
6
9
|
self.data = payload
|
|
7
10
|
|
|
8
11
|
def copy(self):
|
|
9
|
-
return ErrorNo(
|
|
12
|
+
return ErrorNo(
|
|
13
|
+
self.http_status_code,
|
|
14
|
+
self.code,
|
|
15
|
+
copy.deepcopy(self.data),
|
|
16
|
+
copy.deepcopy(self.messages),
|
|
17
|
+
)
|
|
10
18
|
|
|
11
19
|
def get_message(self, lang="en"):
|
|
12
20
|
return self.messages.get(lang, self.messages.get("en", "Unknown error"))
|
|
13
21
|
|
|
22
|
+
def set_message(self, msg, lang="en"):
|
|
23
|
+
self.messages[lang] = msg
|
|
24
|
+
|
|
25
|
+
message = property(fget=get_message, fset=set_message)
|
|
26
|
+
|
|
14
27
|
|
|
15
28
|
class errnos:
|
|
16
29
|
OK = ErrorNo(200, 20000, None, {"en": "Success", "zh": "成功"})
|
bizyengine/bizy_server/server.py
CHANGED
|
@@ -30,6 +30,7 @@ from .utils import (
|
|
|
30
30
|
decrypt_apikey,
|
|
31
31
|
is_string_valid,
|
|
32
32
|
types,
|
|
33
|
+
update_base_model_types,
|
|
33
34
|
)
|
|
34
35
|
|
|
35
36
|
API_PREFIX = "bizyair"
|
|
@@ -39,6 +40,9 @@ USER_API = f"{API_PREFIX}/user"
|
|
|
39
40
|
INVOICE_API = f"{API_PREFIX}/invoices"
|
|
40
41
|
MODEL_API = f"{API_PREFIX}/model"
|
|
41
42
|
|
|
43
|
+
BIZYAIR_DATA_DICT = {}
|
|
44
|
+
BIZYAIR_DATA_DICT_UPDATED_AT = 0.0
|
|
45
|
+
|
|
42
46
|
logging.basicConfig(level=logging.DEBUG)
|
|
43
47
|
|
|
44
48
|
|
|
@@ -310,7 +314,10 @@ class BizyAirServer:
|
|
|
310
314
|
# 检查base_model, path和sign是否有值
|
|
311
315
|
for field in ["base_model", "path", "sign"]:
|
|
312
316
|
if not is_string_valid(version.get(field)):
|
|
313
|
-
|
|
317
|
+
err = errnos.INVALID_VERSION_FIELD.copy()
|
|
318
|
+
err.set_message(err.get_message("en") + ": " + field, "en")
|
|
319
|
+
err.set_message(err.get_message("zh") + ": " + field, "zh")
|
|
320
|
+
return ErrResponse(err)
|
|
314
321
|
|
|
315
322
|
# 调用API更新模型
|
|
316
323
|
request_api_key, err = _get_request_api_key(request.headers)
|
|
@@ -456,12 +463,23 @@ class BizyAirServer:
|
|
|
456
463
|
request_api_key, err = _get_request_api_key(request.headers)
|
|
457
464
|
if err:
|
|
458
465
|
return ErrResponse(err)
|
|
466
|
+
|
|
467
|
+
# 缓存一小时
|
|
468
|
+
global BIZYAIR_DATA_DICT, BIZYAIR_DATA_DICT_UPDATED_AT
|
|
469
|
+
if BIZYAIR_DATA_DICT_UPDATED_AT + 3600 > time.time():
|
|
470
|
+
return OKResponse(BIZYAIR_DATA_DICT)
|
|
471
|
+
|
|
459
472
|
data_dict, err = await self.api_client.get_data_dict(
|
|
460
473
|
request_api_key=request_api_key
|
|
461
474
|
)
|
|
462
475
|
if err is not None:
|
|
463
476
|
return ErrResponse(err)
|
|
464
477
|
|
|
478
|
+
# Update base model types
|
|
479
|
+
update_base_model_types(data_dict["base_models"])
|
|
480
|
+
BIZYAIR_DATA_DICT = data_dict
|
|
481
|
+
BIZYAIR_DATA_DICT_UPDATED_AT = time.time()
|
|
482
|
+
|
|
465
483
|
return OKResponse(data_dict)
|
|
466
484
|
|
|
467
485
|
@self.prompt_server.routes.post(f"/{COMMUNITY_API}/datasets")
|
|
@@ -1054,7 +1072,8 @@ class BizyAirServer:
|
|
|
1054
1072
|
for field in ["base_model", "path", "sign"]:
|
|
1055
1073
|
if not is_string_valid(version.get(field)):
|
|
1056
1074
|
err = errnos.INVALID_VERSION_FIELD.copy()
|
|
1057
|
-
err.
|
|
1075
|
+
err.set_message(err.get_message("en") + ": " + field, "en")
|
|
1076
|
+
err.set_message(err.get_message("zh") + ": " + field, "zh")
|
|
1058
1077
|
return ErrResponse(err)
|
|
1059
1078
|
|
|
1060
1079
|
# 调用API提交模型
|
bizyengine/bizy_server/utils.py
CHANGED
|
@@ -105,10 +105,17 @@ def types():
|
|
|
105
105
|
return types
|
|
106
106
|
|
|
107
107
|
|
|
108
|
+
def update_base_model_types(new_types_from_dict):
|
|
109
|
+
global BASE_MODEL_TYPE_OPTIONS
|
|
110
|
+
BASE_MODEL_TYPE_OPTIONS = {}
|
|
111
|
+
for item in new_types_from_dict:
|
|
112
|
+
BASE_MODEL_TYPE_OPTIONS[item["label"]] = item["value"]
|
|
113
|
+
|
|
114
|
+
|
|
108
115
|
def base_model_types():
|
|
109
116
|
base_model_types = []
|
|
110
|
-
for
|
|
111
|
-
base_model_types.append({"label":
|
|
117
|
+
for v in BASE_MODEL_TYPE_OPTIONS.values():
|
|
118
|
+
base_model_types.append({"label": v, "value": v})
|
|
112
119
|
return base_model_types
|
|
113
120
|
|
|
114
121
|
|
bizyengine/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.2.
|
|
1
|
+
1.2.33
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bizyengine
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.33
|
|
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,15 +1,15 @@
|
|
|
1
1
|
bizyengine/__init__.py,sha256=GP9V-JM07fz7uv_qTB43QEA2rKdrVJxi5I7LRnn_3ZQ,914
|
|
2
|
-
bizyengine/version.txt,sha256=
|
|
2
|
+
bizyengine/version.txt,sha256=uruE8qHcOMHtyKGjgFCkaQ8HCk39_t-NlbecbI-aF48,7
|
|
3
3
|
bizyengine/bizy_server/__init__.py,sha256=SP9oSblnPo4KQyh7yOGD26YCskFAcQHAZy04nQBNRIw,200
|
|
4
4
|
bizyengine/bizy_server/api_client.py,sha256=t6cwob7hs993oy5WdFcjKtIzfi3S_eUhODdDVv_Hedo,43822
|
|
5
|
-
bizyengine/bizy_server/errno.py,sha256=
|
|
5
|
+
bizyengine/bizy_server/errno.py,sha256=1UiFmE2U7r7hCHgsw4-p_YL0VCmTJc9NyYDEbhkanaY,16336
|
|
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=M9P0oungSiUFGRxev3jJxhUTvjm8ixREQ-DCoyzU0gA,58617
|
|
11
11
|
bizyengine/bizy_server/stream_response.py,sha256=H2XHqlVRtQMhgdztAuG7l8-iV_Pm42u2x6WJ0gNVIW0,9654
|
|
12
|
-
bizyengine/bizy_server/utils.py,sha256=
|
|
12
|
+
bizyengine/bizy_server/utils.py,sha256=dgTyLdJtj3POzIC17TOPx_S7WllRJDdyvF8FdSmBSfU,3957
|
|
13
13
|
bizyengine/bizyair_extras/__init__.py,sha256=EjyLEdLpPm5I4Z25YmnoK4PYQDmsEyXtCXQt9UDGmi0,1009
|
|
14
14
|
bizyengine/bizyair_extras/nodes_advanced_refluxcontrol.py,sha256=cecfjrtnjJAty9aNkhz8BlmHUC1NImkFlUDiA0COEa4,2242
|
|
15
15
|
bizyengine/bizyair_extras/nodes_cogview4.py,sha256=Ni0TDOycczyDhYPvSR68TxGV_wE2uhaxd8MIj-J4-3o,2031
|
|
@@ -77,7 +77,7 @@ bizyengine/misc/route_sam.py,sha256=-bMIR2QalfnszipGxSxvDAHGJa5gPSrjkYPb5baaRg4,
|
|
|
77
77
|
bizyengine/misc/segment_anything.py,sha256=wNKYwlYPMszfwj23524geFZJjZaG4eye65SGaUnh77I,8941
|
|
78
78
|
bizyengine/misc/supernode.py,sha256=STN9gaxfTSErH8OiHeZa47d8z-G9S0I7fXuJvHQOBFM,4532
|
|
79
79
|
bizyengine/misc/utils.py,sha256=deQjBgLAkxIr-NaOMm77TcgBT3ExAp0MFm5ehUJ3CGs,6829
|
|
80
|
-
bizyengine-1.2.
|
|
81
|
-
bizyengine-1.2.
|
|
82
|
-
bizyengine-1.2.
|
|
83
|
-
bizyengine-1.2.
|
|
80
|
+
bizyengine-1.2.33.dist-info/METADATA,sha256=wRBpNpUIpqJs8bk0BWy-FoxDUdZiH42YVmQElIQgAWg,675
|
|
81
|
+
bizyengine-1.2.33.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
82
|
+
bizyengine-1.2.33.dist-info/top_level.txt,sha256=2zapzqxX-we5cRyJkGf9bd5JinRtXp3-_uDI-xCAnc0,11
|
|
83
|
+
bizyengine-1.2.33.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|