bizyengine 1.2.63__py3-none-any.whl → 1.2.65__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/utils.py +3 -0
- bizyengine/bizyair_extras/nodes_gemini.py +157 -0
- bizyengine/version.txt +1 -1
- {bizyengine-1.2.63.dist-info → bizyengine-1.2.65.dist-info}/METADATA +1 -1
- {bizyengine-1.2.63.dist-info → bizyengine-1.2.65.dist-info}/RECORD +7 -7
- {bizyengine-1.2.63.dist-info → bizyengine-1.2.65.dist-info}/WHEEL +0 -0
- {bizyengine-1.2.63.dist-info → bizyengine-1.2.65.dist-info}/top_level.txt +0 -0
bizyengine/bizy_server/utils.py
CHANGED
|
@@ -127,6 +127,9 @@ def is_allow_ext_name(local_file_name):
|
|
|
127
127
|
def decrypt_apikey(apikey_ciphertext):
|
|
128
128
|
if not BIZYAIR_SERVER_MODE_RSA_PRIVATE_KEY_PATH:
|
|
129
129
|
return apikey_ciphertext, None
|
|
130
|
+
# v4.public开头不用解密
|
|
131
|
+
if apikey_ciphertext.startswith("v4.public"):
|
|
132
|
+
return apikey_ciphertext, None
|
|
130
133
|
global _RSA_CIPHER
|
|
131
134
|
if not _RSA_CIPHER:
|
|
132
135
|
with open(BIZYAIR_SERVER_MODE_RSA_PRIVATE_KEY_PATH, "rb") as f:
|
|
@@ -306,3 +306,160 @@ class NanoBanana(BizyAirBaseNode):
|
|
|
306
306
|
except Exception as e:
|
|
307
307
|
logging.error(f"Gemini API error: {e}")
|
|
308
308
|
raise e
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
class NanoBananaPro(BizyAirBaseNode):
|
|
312
|
+
def __init__(self):
|
|
313
|
+
pass
|
|
314
|
+
|
|
315
|
+
@classmethod
|
|
316
|
+
def INPUT_TYPES(s):
|
|
317
|
+
return {
|
|
318
|
+
"required": {
|
|
319
|
+
"prompt": (
|
|
320
|
+
"STRING",
|
|
321
|
+
{
|
|
322
|
+
"multiline": True,
|
|
323
|
+
"default": "",
|
|
324
|
+
},
|
|
325
|
+
),
|
|
326
|
+
"operation": (
|
|
327
|
+
["generate", "edit", "style_transfer", "object_insertion"],
|
|
328
|
+
{
|
|
329
|
+
"default": "generate",
|
|
330
|
+
"tooltip": "Choose the type of image operation",
|
|
331
|
+
},
|
|
332
|
+
),
|
|
333
|
+
"temperature": (
|
|
334
|
+
"FLOAT",
|
|
335
|
+
{"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.05},
|
|
336
|
+
),
|
|
337
|
+
"top_p": (
|
|
338
|
+
"FLOAT",
|
|
339
|
+
{"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.05},
|
|
340
|
+
),
|
|
341
|
+
"seed": ("INT", {"default": 0, "min": 0, "max": 2147483647}),
|
|
342
|
+
"max_tokens": ("INT", {"default": 32768, "min": 1, "max": 32768}),
|
|
343
|
+
"aspect_ratio": (
|
|
344
|
+
["1:1", "16:9", "9:16", "4:3", "3:4"],
|
|
345
|
+
{"default": "1:1", "tooltip": "Output image aspect ratio"},
|
|
346
|
+
),
|
|
347
|
+
"resolution": (["1K", "2K", "4K"], {"default": "1K"}),
|
|
348
|
+
},
|
|
349
|
+
"optional": {
|
|
350
|
+
"images": ("IMAGE",),
|
|
351
|
+
"quality": (
|
|
352
|
+
["standard", "high"],
|
|
353
|
+
{"default": "high", "tooltip": "Image generation quality"},
|
|
354
|
+
),
|
|
355
|
+
"character_consistency": (
|
|
356
|
+
"BOOLEAN",
|
|
357
|
+
{
|
|
358
|
+
"default": True,
|
|
359
|
+
"tooltip": "Maintain character consistency across edits",
|
|
360
|
+
},
|
|
361
|
+
),
|
|
362
|
+
},
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
RETURN_TYPES = ("IMAGE", "STRING")
|
|
366
|
+
FUNCTION = "execute"
|
|
367
|
+
OUTPUT_NODE = False
|
|
368
|
+
CATEGORY = "☁️BizyAir/External APIs/Gemini"
|
|
369
|
+
|
|
370
|
+
def execute(
|
|
371
|
+
self,
|
|
372
|
+
prompt,
|
|
373
|
+
operation,
|
|
374
|
+
temperature,
|
|
375
|
+
top_p,
|
|
376
|
+
seed,
|
|
377
|
+
max_tokens,
|
|
378
|
+
aspect_ratio,
|
|
379
|
+
resolution,
|
|
380
|
+
images=None,
|
|
381
|
+
quality=None,
|
|
382
|
+
character_consistency=None,
|
|
383
|
+
**kwargs,
|
|
384
|
+
):
|
|
385
|
+
try:
|
|
386
|
+
url = f"{BIZYAIR_SERVER_ADDRESS}/proxy_inference/VertexAI/gemini-3-pro-image-preview"
|
|
387
|
+
extra_data = pop_api_key_and_prompt_id(kwargs)
|
|
388
|
+
|
|
389
|
+
if len(images) > 14:
|
|
390
|
+
raise ValueError("Maximum number of images is 14")
|
|
391
|
+
parts = []
|
|
392
|
+
for batch_number, image in enumerate(images):
|
|
393
|
+
if image is not None:
|
|
394
|
+
parts.append(
|
|
395
|
+
{
|
|
396
|
+
"inline_data": {
|
|
397
|
+
"mime_type": "image/png",
|
|
398
|
+
"data": tensor_to_base64_string(image),
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
)
|
|
402
|
+
|
|
403
|
+
prompt = build_prompt_for_operation(
|
|
404
|
+
prompt,
|
|
405
|
+
operation,
|
|
406
|
+
has_references=len(parts) > 0,
|
|
407
|
+
aspect_ratio=aspect_ratio,
|
|
408
|
+
character_consistency=character_consistency,
|
|
409
|
+
)
|
|
410
|
+
if quality == "high":
|
|
411
|
+
prompt += " Use the highest quality settings available."
|
|
412
|
+
parts.append({"text": prompt})
|
|
413
|
+
|
|
414
|
+
data = {
|
|
415
|
+
"contents": {
|
|
416
|
+
"parts": parts,
|
|
417
|
+
"role": "user",
|
|
418
|
+
},
|
|
419
|
+
"generationConfig": {
|
|
420
|
+
"seed": seed,
|
|
421
|
+
"responseModalities": ["TEXT", "IMAGE"],
|
|
422
|
+
"temperature": temperature,
|
|
423
|
+
"topP": top_p,
|
|
424
|
+
"maxOutputTokens": max_tokens,
|
|
425
|
+
"imageConfig": {
|
|
426
|
+
"imageSize": resolution,
|
|
427
|
+
"aspectRatio": aspect_ratio,
|
|
428
|
+
},
|
|
429
|
+
},
|
|
430
|
+
}
|
|
431
|
+
json_payload = json.dumps(data).encode("utf-8")
|
|
432
|
+
headers = client.headers(api_key=extra_data["api_key"])
|
|
433
|
+
headers["X-BIZYAIR-PROMPT-ID"] = extra_data[
|
|
434
|
+
"prompt_id"
|
|
435
|
+
] # 额外参数vertexai会拒绝,所以用请求头传
|
|
436
|
+
resp = client.send_request(
|
|
437
|
+
url=url,
|
|
438
|
+
data=json_payload,
|
|
439
|
+
headers=headers,
|
|
440
|
+
)
|
|
441
|
+
# 解析潜在错误
|
|
442
|
+
prompt_feedback = resp.get("promptFeedback", None)
|
|
443
|
+
if prompt_feedback:
|
|
444
|
+
logging.error(f"Response: {resp}")
|
|
445
|
+
raise ValueError(f"Prompt blocked: {prompt_feedback}")
|
|
446
|
+
if len(resp.get("candidates", [])) == 0:
|
|
447
|
+
logging.error(f"Response: {resp}")
|
|
448
|
+
raise ValueError("No candidates found in response")
|
|
449
|
+
if resp["candidates"][0]["finishReason"] != "STOP":
|
|
450
|
+
logging.error(f"Response: {resp}")
|
|
451
|
+
raise ValueError(
|
|
452
|
+
f"Erroneous finish reason: {resp['candidates'][0]['finishReason']}"
|
|
453
|
+
)
|
|
454
|
+
|
|
455
|
+
# 解析文本
|
|
456
|
+
text = get_text_from_response(resp)
|
|
457
|
+
|
|
458
|
+
# 解析base64图片
|
|
459
|
+
image = get_image_from_response(resp)
|
|
460
|
+
|
|
461
|
+
return (image, text)
|
|
462
|
+
|
|
463
|
+
except Exception as e:
|
|
464
|
+
logging.error(f"Gemini API error: {e}")
|
|
465
|
+
raise e
|
bizyengine/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.2.
|
|
1
|
+
1.2.65
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bizyengine
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.65
|
|
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=
|
|
2
|
+
bizyengine/version.txt,sha256=Q7lTHk3BCaZ6Qd8I4VGIHdrVAe3qSAgWvgjXfbu2beQ,7
|
|
3
3
|
bizyengine/bizy_server/__init__.py,sha256=SP9oSblnPo4KQyh7yOGD26YCskFAcQHAZy04nQBNRIw,200
|
|
4
4
|
bizyengine/bizy_server/api_client.py,sha256=Z7G5IjaEqSJkF6nLLw2R3bpgBAOi5ClQiUbel6NMXmE,43932
|
|
5
5
|
bizyengine/bizy_server/errno.py,sha256=RIyvegX3lzpx_1L1q2XVvu3on0kvYgKiUQ8U3ZtyF68,16823
|
|
@@ -9,7 +9,7 @@ bizyengine/bizy_server/profile.py,sha256=f4juAzJ73gCm0AhagYpt9WnG8HEI6xze_U96-om
|
|
|
9
9
|
bizyengine/bizy_server/resp.py,sha256=iOFT5Ud7VJBP2uqkojJIgc3y2ifMjjEXoj0ewneL9lc,710
|
|
10
10
|
bizyengine/bizy_server/server.py,sha256=isOzHDk2kD6WjdlemeOA7j_xLnZ2vat_NvE1I0bsOFw,57490
|
|
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=t3y3ZTDzFa8K4wXlzgLVaFNCizgylsKsd9K3rLL4sGw,3986
|
|
13
13
|
bizyengine/bizyair_extras/__init__.py,sha256=GNmQ3C0fG8pIGgAMV6M9Jp89fOOVd-YpsLOuIWgjxF4,1092
|
|
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
|
|
@@ -22,7 +22,7 @@ bizyengine/bizyair_extras/nodes_custom_sampler.py,sha256=NK-7sdcp8oxJisjTEFfBskk
|
|
|
22
22
|
bizyengine/bizyair_extras/nodes_dataset.py,sha256=htF0YZb_FHncLhLDEbJfNCVqJ6rvlo1ZLk7iY42Rylc,3440
|
|
23
23
|
bizyengine/bizyair_extras/nodes_differential_diffusion.py,sha256=nSrbD-w0XtrwktwzME5M0Vmi1sI7Z08AqwgymTdThqo,370
|
|
24
24
|
bizyengine/bizyair_extras/nodes_flux.py,sha256=ls94kGBuBNgW5c6uhG36iZLk1TTM2TIoTTcpERgEE5E,2683
|
|
25
|
-
bizyengine/bizyair_extras/nodes_gemini.py,sha256=
|
|
25
|
+
bizyengine/bizyair_extras/nodes_gemini.py,sha256=UpVe-v5ubotg0wiDQ6CpgvH0PMyXEMoT6IluOt1dRQw,16044
|
|
26
26
|
bizyengine/bizyair_extras/nodes_hunyuan3d.py,sha256=dWHLeqX68N7zKnfDMzm9nutmCNtFT6-wwt7P5cPDu7Q,2058
|
|
27
27
|
bizyengine/bizyair_extras/nodes_image_utils.py,sha256=BldF_CKD2M01K8-SnG-QV86u3HZqFz_GP5GrCQ5CFDQ,2875
|
|
28
28
|
bizyengine/bizyair_extras/nodes_ip2p.py,sha256=GSEFJvrs4f2tv0xwYkWqc8uhsXrzAJVPvvwcw0gTjR0,619
|
|
@@ -97,7 +97,7 @@ bizyengine/misc/route_sam.py,sha256=-bMIR2QalfnszipGxSxvDAHGJa5gPSrjkYPb5baaRg4,
|
|
|
97
97
|
bizyengine/misc/segment_anything.py,sha256=wNKYwlYPMszfwj23524geFZJjZaG4eye65SGaUnh77I,8941
|
|
98
98
|
bizyengine/misc/supernode.py,sha256=STN9gaxfTSErH8OiHeZa47d8z-G9S0I7fXuJvHQOBFM,4532
|
|
99
99
|
bizyengine/misc/utils.py,sha256=nXXTPkj4WBvds4EWjI9c-ydeWwmXl8Vwrdu-4Fh62g8,12914
|
|
100
|
-
bizyengine-1.2.
|
|
101
|
-
bizyengine-1.2.
|
|
102
|
-
bizyengine-1.2.
|
|
103
|
-
bizyengine-1.2.
|
|
100
|
+
bizyengine-1.2.65.dist-info/METADATA,sha256=5UQntC6jGRJeo5A1urHuiSk-5Hq_v7LV0_tJwJrnBIA,735
|
|
101
|
+
bizyengine-1.2.65.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
102
|
+
bizyengine-1.2.65.dist-info/top_level.txt,sha256=2zapzqxX-we5cRyJkGf9bd5JinRtXp3-_uDI-xCAnc0,11
|
|
103
|
+
bizyengine-1.2.65.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|