bizyengine 1.2.29__py3-none-any.whl → 1.2.30__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.
@@ -3,6 +3,7 @@ import configparser
3
3
  import json
4
4
  import logging
5
5
  import os
6
+ import random
6
7
  import shutil
7
8
  import threading
8
9
  import time
@@ -14,7 +15,8 @@ import execution
14
15
  import openai
15
16
  from server import PromptServer
16
17
 
17
- from bizyengine.core.common.env_var import BIZYAIR_SERVER_MODE
18
+ from bizyengine.core.common.env_var import BIZYAIR_SERVER_ADDRESS, BIZYAIR_SERVER_MODE
19
+ from bizyengine.core.configs.conf import ModelRule, config_manager
18
20
 
19
21
  from .api_client import APIClient
20
22
  from .errno import ErrorNo, errnos
@@ -47,6 +49,16 @@ def _get_request_api_key(request_headers):
47
49
  return None, None
48
50
 
49
51
 
52
+ def _get_api_key_from_cookie(cookie_str):
53
+ if not cookie_str:
54
+ return None
55
+ cookies = cookie_str.split("; ")
56
+ for cookie in cookies:
57
+ if cookie.startswith("apiKey="):
58
+ return cookie[7:]
59
+ return None
60
+
61
+
50
62
  class BizyAirServer:
51
63
  def __init__(self):
52
64
  BizyAirServer.instance = self
@@ -858,6 +870,60 @@ class BizyAirServer:
858
870
 
859
871
  return ErrResponse(errnos.MODEL_API_ERROR)
860
872
 
873
+ @self.prompt_server.routes.post(f"/{MODEL_API}/image-edit")
874
+ async def image_edit(request):
875
+ try:
876
+ request_api_key, err = _get_request_api_key(request.headers)
877
+ if err:
878
+ return ErrResponse(err)
879
+ auth_header = request.headers.get("Authorization", "")
880
+ cookie_str = request.headers.get("Cookie", "")
881
+ cookie_api_key = _get_api_key_from_cookie(cookie_str)
882
+ request_data = await request.json()
883
+ target_url = f"{BIZYAIR_SERVER_ADDRESS}{config_manager.get_rules('comfyagent-flux1-kontext')[0].route}"
884
+ forward_payload = {
885
+ "prompt": request_data.get("prompt", "请编辑这张图片"),
886
+ "image": request_data.get("image", ""),
887
+ "seed": request_data.get("seed", random.randint(1, 9999999999)),
888
+ "num_inference_steps": request_data.get("num_inference_steps", 20),
889
+ "guidance_scale": request_data.get("guidance_scale", 2.5),
890
+ }
891
+ async with aiohttp.ClientSession() as session:
892
+ headers = {
893
+ "Content-Type": "application/json",
894
+ "User-Agent": "BizyAir Server",
895
+ "x-bizyair-client-version": "1.2.21",
896
+ }
897
+ if request_api_key:
898
+ headers["Authorization"] = f"Bearer {request_api_key}"
899
+ elif cookie_api_key:
900
+ headers["Authorization"] = f"Bearer {cookie_api_key}"
901
+ elif auth_header:
902
+ if not auth_header.startswith("Bearer "):
903
+ headers["Authorization"] = f"Bearer {auth_header}"
904
+ else:
905
+ headers["Authorization"] = auth_header
906
+ else:
907
+ from bizyengine.core.common.env_var import load_api_key
908
+
909
+ has_key, file_api_key = load_api_key()
910
+ if has_key and file_api_key:
911
+ headers["Authorization"] = f"Bearer {file_api_key}"
912
+ logging.debug("Using API key from api_key.ini file")
913
+ async with session.post(
914
+ target_url, headers=headers, json=forward_payload, timeout=120
915
+ ) as response:
916
+ response_data = await response.json()
917
+ logging.debug(response_data)
918
+
919
+ if response.status == 200:
920
+ return OKResponse(response_data)
921
+ else:
922
+ return ErrResponse(errnos.MODEL_API_ERROR)
923
+
924
+ except Exception:
925
+ return ErrResponse(errnos.MODEL_API_ERROR)
926
+
861
927
  @self.prompt_server.routes.post(f"/{MODEL_API}/images")
862
928
  async def image_generations(request):
863
929
  try:
@@ -62,6 +62,14 @@ model_rules:
62
62
  unet_name:
63
63
  - ^flux1-dev-kontext-onediff.safetensors$
64
64
 
65
+ - mode_type: unet
66
+ base_model: FLUX-kontext
67
+ describe: flux1-kontext for bizybot only
68
+ score: 0
69
+ route: /supernode/comfyagent-flux1-kontext
70
+ nodes:
71
+ - class_type: comfyagent-flux1-kontext
72
+
65
73
  - mode_type: unet
66
74
  base_model: FLUX
67
75
  describe: flux1-schnell
bizyengine/version.txt CHANGED
@@ -1 +1 @@
1
- 1.2.29
1
+ 1.2.30
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bizyengine
3
- Version: 1.2.29
3
+ Version: 1.2.30
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,5 +1,5 @@
1
1
  bizyengine/__init__.py,sha256=GP9V-JM07fz7uv_qTB43QEA2rKdrVJxi5I7LRnn_3ZQ,914
2
- bizyengine/version.txt,sha256=8UbXkWb3cQmVLROEmDOpmLGeuURRw6434TkE3B5WEfI,6
2
+ bizyengine/version.txt,sha256=JlhCJgvOLCf0knGqzSmKCYF_ZcqtpjyEa5v066aASRM,6
3
3
  bizyengine/bizy_server/__init__.py,sha256=SP9oSblnPo4KQyh7yOGD26YCskFAcQHAZy04nQBNRIw,200
4
4
  bizyengine/bizy_server/api_client.py,sha256=t6cwob7hs993oy5WdFcjKtIzfi3S_eUhODdDVv_Hedo,43822
5
5
  bizyengine/bizy_server/errno.py,sha256=Q-U96XnZQCuPH_44Om8wnc2-Kh7qFqwLKtox27msU54,16095
@@ -7,7 +7,7 @@ bizyengine/bizy_server/error_handler.py,sha256=MGrfO1AEqbfEgMWPL8B6Ypew_zHiQAdYG
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=bPJaLX8AoHPq4u-q5nuwf58jezXNQdsHO_wUibi10Ik,54594
10
+ bizyengine/bizy_server/server.py,sha256=Eyg1wqyvr7n2kQGLIKvPKyhUIPoG92refahTQjkTweo,57815
11
11
  bizyengine/bizy_server/stream_response.py,sha256=H2XHqlVRtQMhgdztAuG7l8-iV_Pm42u2x6WJ0gNVIW0,9654
12
12
  bizyengine/bizy_server/utils.py,sha256=CIoRrCy8Wv4D9FDdr_QtNP03AjWw8M6GSm2QcrVJl6Y,3739
13
13
  bizyengine/bizyair_extras/__init__.py,sha256=EjyLEdLpPm5I4Z25YmnoK4PYQDmsEyXtCXQt9UDGmi0,1009
@@ -62,7 +62,7 @@ bizyengine/core/common/env_var.py,sha256=1EAW3gOXY2bKouCqrGa583vTJRdDasQ1IsFTnzD
62
62
  bizyengine/core/common/utils.py,sha256=bm-XmSPy83AyjD0v5EfWp6jiO6_5p7rkZ_HQAuVmgmo,3086
63
63
  bizyengine/core/configs/conf.py,sha256=D_UWG9SSJnK5EhbrfNFryJQ8hUwwdvhOGlq1TielwpI,3830
64
64
  bizyengine/core/configs/models.json,sha256=NqYVmp-ICpr1vFgafWjJMu5dyuRt9ffVUJmov3_-xRY,2746
65
- bizyengine/core/configs/models.yaml,sha256=ZsHC2vBS8jfhwgT7NId2G7Hf_iJX3Az7ykbPN3h-1EQ,9648
65
+ bizyengine/core/configs/models.yaml,sha256=K6b6eNMZCM_bHWBME8DlF2FyonD_9qXLBHcxKiP6WYg,9859
66
66
  bizyengine/core/path_utils/__init__.py,sha256=JVpqNHgaKiEtTI8_r47af8GtWHxrtOockQ6Qpzp9_MQ,260
67
67
  bizyengine/core/path_utils/path_manager.py,sha256=tRVAcpsYvfWD-tK7khLvNCZayB0wpU9L0tRTH4ZESzM,10549
68
68
  bizyengine/core/path_utils/utils.py,sha256=kQfPQjGU27qF9iyzRxLSRg5cMsd-VixuCUldART7cgY,2394
@@ -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.29.dist-info/METADATA,sha256=7ephykrOGACrIgVCPXBXRq1SqHhkGJ7r-HmB7geWUT0,675
81
- bizyengine-1.2.29.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
82
- bizyengine-1.2.29.dist-info/top_level.txt,sha256=2zapzqxX-we5cRyJkGf9bd5JinRtXp3-_uDI-xCAnc0,11
83
- bizyengine-1.2.29.dist-info/RECORD,,
80
+ bizyengine-1.2.30.dist-info/METADATA,sha256=Sk1xkJ14fUPjoOi-V_qMnI07h-uQGMVp5gKarw8uVTg,675
81
+ bizyengine-1.2.30.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
82
+ bizyengine-1.2.30.dist-info/top_level.txt,sha256=2zapzqxX-we5cRyJkGf9bd5JinRtXp3-_uDI-xCAnc0,11
83
+ bizyengine-1.2.30.dist-info/RECORD,,