bizyengine 1.2.4__tar.gz → 1.2.5__tar.gz
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-1.2.4 → bizyengine-1.2.5}/PKG-INFO +1 -1
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizy_server/api_client.py +17 -91
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizy_server/server.py +52 -100
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/misc/llm.py +1 -1
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/misc/utils.py +3 -2
- bizyengine-1.2.5/bizyengine/version.txt +1 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine.egg-info/PKG-INFO +1 -1
- bizyengine-1.2.4/bizyengine/version.txt +0 -1
- {bizyengine-1.2.4 → bizyengine-1.2.5}/MANIFEST.in +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/README.md +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/__init__.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizy_server/__init__.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizy_server/errno.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizy_server/error_handler.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizy_server/execution.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizy_server/profile.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizy_server/resp.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizy_server/stream_response.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizy_server/utils.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/__init__.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_advanced_refluxcontrol.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_cogview4.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_comfyui_detail_daemon.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_comfyui_instantid.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_comfyui_layerstyle_advance.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_comfyui_pulid_flux.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_controlnet.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_custom_sampler.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_dataset.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_differential_diffusion.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_flux.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_image_utils.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_ip2p.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_ipadapter_plus/__init__.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_ipadapter_plus/nodes_ipadapter_plus.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_janus_pro.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_kolors_mz/__init__.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_model_advanced.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_nunchaku.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_sd3.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_segment_anything.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_segment_anything_utils.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_testing_utils.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_trellis.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_ultimatesdupscale.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_upscale_model.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_wan_video.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/oauth_callback/main.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/route_bizyair_tools.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/core/__init__.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/core/commands/__init__.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/core/commands/base.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/core/commands/invoker.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/core/commands/processors/model_hosting_processor.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/core/commands/processors/prompt_processor.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/core/commands/servers/model_server.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/core/commands/servers/prompt_server.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/core/common/__init__.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/core/common/caching.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/core/common/client.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/core/common/env_var.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/core/common/utils.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/core/configs/conf.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/core/configs/models.json +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/core/configs/models.yaml +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/core/data_types.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/core/image_utils.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/core/nodes_base.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/core/nodes_io.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/core/path_utils/__init__.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/core/path_utils/path_manager.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/core/path_utils/utils.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/misc/__init__.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/misc/auth.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/misc/mzkolors.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/misc/nodes.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/misc/nodes_controlnet_aux.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/misc/nodes_controlnet_union_sdxl.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/misc/route_sam.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/misc/segment_anything.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/misc/supernode.py +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine.egg-info/SOURCES.txt +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine.egg-info/dependency_links.txt +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine.egg-info/requires.txt +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine.egg-info/top_level.txt +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/pyproject.toml +0 -0
- {bizyengine-1.2.4 → bizyengine-1.2.5}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bizyengine
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.5
|
|
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
|
|
@@ -11,6 +11,7 @@ from bizyengine.core.common.env_var import (
|
|
|
11
11
|
BIZYAIR_X_SERVER,
|
|
12
12
|
BIZYAIR_Y_SERVER,
|
|
13
13
|
)
|
|
14
|
+
from openai import OpenAI
|
|
14
15
|
|
|
15
16
|
from .errno import ErrorNo, errnos
|
|
16
17
|
from .error_handler import ErrorHandler
|
|
@@ -1078,14 +1079,11 @@ class APIClient:
|
|
|
1078
1079
|
print(f"\033[31m[BizyAir]\033[0m Fail to get recent cost: {str(e)}")
|
|
1079
1080
|
return None, errnos.GET_RECENT_COST
|
|
1080
1081
|
|
|
1081
|
-
|
|
1082
|
+
def forward_model_request(self, request_data):
|
|
1082
1083
|
try:
|
|
1083
|
-
import asyncio
|
|
1084
|
-
import json
|
|
1085
|
-
|
|
1086
|
-
from .stream_response import StreamResponse
|
|
1087
|
-
|
|
1088
1084
|
request_data["stream"] = True
|
|
1085
|
+
# 硅基云API接受top_k但是openai库不支持
|
|
1086
|
+
request_data.pop("top_k")
|
|
1089
1087
|
# 参数检查
|
|
1090
1088
|
if "messages" not in request_data:
|
|
1091
1089
|
return None, errnos.MODEL_API_ERROR
|
|
@@ -1096,98 +1094,26 @@ class APIClient:
|
|
|
1096
1094
|
):
|
|
1097
1095
|
return None, errnos.MODEL_API_ERROR
|
|
1098
1096
|
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
# 创建自定义流式响应对象,设置60秒超时
|
|
1103
|
-
response_stream = StreamResponse(request_data, timeout=60)
|
|
1097
|
+
if "model" not in request_data:
|
|
1098
|
+
return None, errnos.MODEL_API_ERROR
|
|
1104
1099
|
|
|
1105
|
-
#
|
|
1106
|
-
|
|
1100
|
+
# TODO: 前端能选择provider、model之后删除下句
|
|
1101
|
+
request_data["model"] = f"SiliconFlow:{request_data['model']}"
|
|
1107
1102
|
|
|
1108
|
-
|
|
1109
|
-
|
|
1103
|
+
client = OpenAI(
|
|
1104
|
+
base_url=BIZYAIR_X_SERVER,
|
|
1105
|
+
api_key=get_api_key(),
|
|
1106
|
+
timeout=60.0,
|
|
1107
|
+
max_retries=0,
|
|
1108
|
+
)
|
|
1109
|
+
return client.chat.completions.with_streaming_response.create(
|
|
1110
|
+
**request_data
|
|
1111
|
+
)
|
|
1110
1112
|
|
|
1111
1113
|
except Exception as e:
|
|
1112
1114
|
print(f"\033[31m[BizyAir]\033[0m Model API forwarding failed: {str(e)}")
|
|
1113
1115
|
return None, errnos.MODEL_API_ERROR
|
|
1114
1116
|
|
|
1115
|
-
async def stream_model_response(self, response):
|
|
1116
|
-
"""
|
|
1117
|
-
流式传输模型响应
|
|
1118
|
-
|
|
1119
|
-
Args:
|
|
1120
|
-
response: 从API获取的StreamResponse对象
|
|
1121
|
-
|
|
1122
|
-
Returns:
|
|
1123
|
-
一个异步生成器,用于流式传输响应数据
|
|
1124
|
-
"""
|
|
1125
|
-
# 生成请求ID用于日志
|
|
1126
|
-
req_id = f"stream-{id(response)}"
|
|
1127
|
-
|
|
1128
|
-
# 验证response对象是否有效
|
|
1129
|
-
if not response:
|
|
1130
|
-
print(f"\033[31m[BizyAir-{req_id}]\033[0m 无效的response对象 (为None)")
|
|
1131
|
-
yield b'data: {"error": "Invalid response object (None)"}\n\n'
|
|
1132
|
-
yield b"data: [DONE]\n\n"
|
|
1133
|
-
return
|
|
1134
|
-
|
|
1135
|
-
if not hasattr(response, "content") or not hasattr(
|
|
1136
|
-
response.content, "iter_any"
|
|
1137
|
-
):
|
|
1138
|
-
print(
|
|
1139
|
-
f"\033[31m[BizyAir-{req_id}]\033[0m 无效的response对象 (缺少必要方法)"
|
|
1140
|
-
)
|
|
1141
|
-
yield b'data: {"error": "Invalid response object (missing methods)"}\n\n'
|
|
1142
|
-
yield b"data: [DONE]\n\n"
|
|
1143
|
-
return
|
|
1144
|
-
|
|
1145
|
-
error_occurred = False
|
|
1146
|
-
chunks_forwarded = 0
|
|
1147
|
-
chunk = None # 定义在外部,以便finally块可以访问
|
|
1148
|
-
|
|
1149
|
-
try:
|
|
1150
|
-
# 使用StreamResponse.iter_any方法创建流式传输生成器
|
|
1151
|
-
async for chunk in response.content.iter_any():
|
|
1152
|
-
chunks_forwarded += 1
|
|
1153
|
-
|
|
1154
|
-
yield chunk
|
|
1155
|
-
# 是否是结束标记
|
|
1156
|
-
if b"data: [DONE]" in chunk:
|
|
1157
|
-
break
|
|
1158
|
-
# 是否包含错误
|
|
1159
|
-
if b'data: {"error"' in chunk or b'data: {"message":' in chunk:
|
|
1160
|
-
error_occurred = True
|
|
1161
|
-
|
|
1162
|
-
except Exception as e:
|
|
1163
|
-
error_occurred = True
|
|
1164
|
-
error_msg = f"读取流式数据失败: {str(e)}"
|
|
1165
|
-
print(f"\033[31m[BizyAir-{req_id}]\033[0m {error_msg}")
|
|
1166
|
-
|
|
1167
|
-
# 返回错误消息
|
|
1168
|
-
error_json = json.dumps({"error": error_msg})
|
|
1169
|
-
yield f"data: {error_json}\n\n".encode("utf-8")
|
|
1170
|
-
|
|
1171
|
-
# 如果还没有发送过DONE,则发送
|
|
1172
|
-
if chunks_forwarded == 0 or (chunk and not b"data: [DONE]" in chunk):
|
|
1173
|
-
yield b"data: [DONE]\n\n"
|
|
1174
|
-
|
|
1175
|
-
finally:
|
|
1176
|
-
# 如果没有发生错误,但也没有转发任何数据,发送一个空响应
|
|
1177
|
-
if not error_occurred and chunks_forwarded == 0:
|
|
1178
|
-
yield b'data: {"content": ""}\n\n'
|
|
1179
|
-
yield b"data: [DONE]\n\n"
|
|
1180
|
-
|
|
1181
|
-
async def release(self):
|
|
1182
|
-
"""关闭连接"""
|
|
1183
|
-
if self.writer and not self.closed:
|
|
1184
|
-
self.writer.close()
|
|
1185
|
-
try:
|
|
1186
|
-
await self.writer.wait_closed()
|
|
1187
|
-
except Exception:
|
|
1188
|
-
pass
|
|
1189
|
-
self.closed = True
|
|
1190
|
-
|
|
1191
1117
|
async def forward_image_request(self, request_data):
|
|
1192
1118
|
try:
|
|
1193
1119
|
api_key = get_api_key()
|
|
@@ -10,6 +10,7 @@ import urllib.parse
|
|
|
10
10
|
import uuid
|
|
11
11
|
|
|
12
12
|
import aiohttp
|
|
13
|
+
import openai
|
|
13
14
|
from server import PromptServer
|
|
14
15
|
|
|
15
16
|
from .api_client import APIClient
|
|
@@ -970,108 +971,69 @@ class BizyAirServer:
|
|
|
970
971
|
request_data = await request.json()
|
|
971
972
|
|
|
972
973
|
# 转发请求到模型服务
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
974
|
+
with self.api_client.forward_model_request(request_data) as response:
|
|
975
|
+
# 创建并准备流式响应
|
|
976
|
+
resp = aiohttp.web.StreamResponse(
|
|
977
|
+
status=200,
|
|
978
|
+
reason="OK",
|
|
979
|
+
headers={
|
|
980
|
+
"Content-Type": "text/event-stream",
|
|
981
|
+
"Cache-Control": "no-cache",
|
|
982
|
+
"Connection": "keep-alive",
|
|
983
|
+
"X-Accel-Buffering": "no", # 禁用Nginx缓冲
|
|
984
|
+
},
|
|
979
985
|
)
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
# 创建并准备流式响应
|
|
983
|
-
resp = aiohttp.web.StreamResponse(
|
|
984
|
-
status=200,
|
|
985
|
-
reason="OK",
|
|
986
|
-
headers={
|
|
987
|
-
"Content-Type": "text/event-stream",
|
|
988
|
-
"Cache-Control": "no-cache",
|
|
989
|
-
"Connection": "keep-alive",
|
|
990
|
-
"X-Accel-Buffering": "no", # 禁用Nginx缓冲
|
|
991
|
-
},
|
|
992
|
-
)
|
|
993
|
-
await resp.prepare(request)
|
|
994
|
-
|
|
995
|
-
# 确保异步生成器正确创建
|
|
996
|
-
generator = self.api_client.stream_model_response(response)
|
|
997
|
-
if not generator:
|
|
998
|
-
print(f"\033[31m[聊天请求-{req_id}]\033[0m 创建异步生成器失败")
|
|
999
|
-
# 返回错误响应
|
|
1000
|
-
if not resp.prepared:
|
|
1001
|
-
return ErrResponse(errnos.MODEL_API_ERROR)
|
|
1002
|
-
else:
|
|
1003
|
-
# 如果响应已准备,发送错误数据帧
|
|
1004
|
-
try:
|
|
1005
|
-
error_msg = json.dumps({"error": "创建数据流失败"})
|
|
1006
|
-
await resp.write(f"data: {error_msg}\n\n".encode("utf-8"))
|
|
1007
|
-
await resp.write(b"data: [DONE]\n\n")
|
|
1008
|
-
except Exception as e:
|
|
1009
|
-
print(
|
|
1010
|
-
f"\033[31m[聊天请求-{req_id}]\033[0m 写入错误消息时出错: {str(e)}"
|
|
1011
|
-
)
|
|
1012
|
-
finally:
|
|
1013
|
-
try:
|
|
1014
|
-
await resp.write_eof()
|
|
1015
|
-
except:
|
|
1016
|
-
pass
|
|
1017
|
-
return resp
|
|
1018
|
-
|
|
1019
|
-
# 开始流式传输
|
|
1020
|
-
any_chunk_sent = False # 跟踪是否发送了任何数据块
|
|
986
|
+
await resp.prepare(request)
|
|
1021
987
|
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
988
|
+
# 开始流式传输
|
|
989
|
+
any_chunk_sent = False # 跟踪是否发送了任何数据块
|
|
990
|
+
try:
|
|
991
|
+
for bytes in response.iter_bytes(1024):
|
|
992
|
+
if bytes:
|
|
993
|
+
await resp.write(bytes)
|
|
1027
994
|
any_chunk_sent = True
|
|
1028
995
|
await resp.drain() # 确保数据被立即发送
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
996
|
+
except Exception as e:
|
|
997
|
+
print(
|
|
998
|
+
f"\033[31m[聊天请求-{req_id}]\033[0m 流式传输错误: {str(e)}"
|
|
999
|
+
)
|
|
1000
|
+
# 如果尚未发送任何数据块,尝试发送错误信息
|
|
1001
|
+
if not any_chunk_sent and not resp.prepared:
|
|
1002
|
+
return ErrResponse(errnos.MODEL_API_ERROR)
|
|
1003
|
+
elif not any_chunk_sent:
|
|
1004
|
+
try:
|
|
1005
|
+
error_msg = json.dumps(
|
|
1006
|
+
{"error": f"流式传输错误: {str(e)}"}
|
|
1007
|
+
)
|
|
1008
|
+
await resp.write(
|
|
1009
|
+
f"data: {error_msg}\n\n".encode("utf-8")
|
|
1010
|
+
)
|
|
1011
|
+
await resp.write(b"data: [DONE]\n\n")
|
|
1012
|
+
except Exception as write_err:
|
|
1034
1013
|
print(
|
|
1035
|
-
f"\033[31m[聊天请求-{req_id}]\033[0m
|
|
1014
|
+
f"\033[31m[聊天请求-{req_id}]\033[0m 写入错误消息时出错: {str(write_err)}"
|
|
1036
1015
|
)
|
|
1037
|
-
|
|
1038
|
-
except Exception as e:
|
|
1039
|
-
print(f"\033[31m[聊天请求-{req_id}]\033[0m 流式传输错误: {str(e)}")
|
|
1040
|
-
# 如果尚未发送任何数据块,尝试发送错误信息
|
|
1041
|
-
if not any_chunk_sent and not resp.prepared:
|
|
1042
|
-
return ErrResponse(errnos.MODEL_API_ERROR)
|
|
1043
|
-
elif not any_chunk_sent:
|
|
1044
|
-
try:
|
|
1045
|
-
error_msg = json.dumps({"error": f"流式传输错误: {str(e)}"})
|
|
1046
|
-
await resp.write(f"data: {error_msg}\n\n".encode("utf-8"))
|
|
1047
|
-
await resp.write(b"data: [DONE]\n\n")
|
|
1048
|
-
except Exception as write_err:
|
|
1049
|
-
print(
|
|
1050
|
-
f"\033[31m[聊天请求-{req_id}]\033[0m 写入错误消息时出错: {str(write_err)}"
|
|
1051
|
-
)
|
|
1052
|
-
|
|
1053
|
-
# 检查是否发送了数据
|
|
1054
|
-
if not any_chunk_sent:
|
|
1055
|
-
print(
|
|
1056
|
-
f"\033[33m[聊天请求-{req_id}]\033[0m 警告: 没有发送任何数据块"
|
|
1057
|
-
)
|
|
1016
|
+
|
|
1058
1017
|
try:
|
|
1059
|
-
await resp.
|
|
1060
|
-
await resp.write(b"data: [DONE]\n\n")
|
|
1018
|
+
await resp.write_eof()
|
|
1061
1019
|
except Exception as e:
|
|
1062
1020
|
print(
|
|
1063
|
-
f"\033[31m[聊天请求-{req_id}]\033[0m
|
|
1021
|
+
f"\033[31m[聊天请求-{req_id}]\033[0m 结束响应时出错: {str(e)}"
|
|
1064
1022
|
)
|
|
1065
1023
|
|
|
1066
|
-
|
|
1067
|
-
await resp.write_eof()
|
|
1068
|
-
except Exception as e:
|
|
1069
|
-
print(
|
|
1070
|
-
f"\033[31m[聊天请求-{req_id}]\033[0m 结束响应时出错: {str(e)}"
|
|
1071
|
-
)
|
|
1072
|
-
|
|
1073
|
-
return resp
|
|
1024
|
+
return resp
|
|
1074
1025
|
|
|
1026
|
+
except openai.APIConnectionError as e:
|
|
1027
|
+
print("The server could not be reached")
|
|
1028
|
+
print(
|
|
1029
|
+
e.__cause__
|
|
1030
|
+
) # an underlying Exception, likely raised within httpx.
|
|
1031
|
+
except openai.RateLimitError:
|
|
1032
|
+
print("A 429 status code was received; we should back off a bit.")
|
|
1033
|
+
except openai.APIStatusError as e:
|
|
1034
|
+
print("Another non-200-range status code was received")
|
|
1035
|
+
print(e.status_code)
|
|
1036
|
+
print(e.response)
|
|
1075
1037
|
except Exception as e:
|
|
1076
1038
|
print(
|
|
1077
1039
|
f"\033[31m[聊天请求-{req_id}]\033[0m 处理请求时发生错误: {str(e)}"
|
|
@@ -1089,16 +1051,6 @@ class BizyAirServer:
|
|
|
1089
1051
|
|
|
1090
1052
|
return ErrResponse(errnos.MODEL_API_ERROR)
|
|
1091
1053
|
|
|
1092
|
-
finally:
|
|
1093
|
-
# 确保所有资源被释放
|
|
1094
|
-
if response and hasattr(response, "release"):
|
|
1095
|
-
try:
|
|
1096
|
-
await response.release()
|
|
1097
|
-
except Exception as e:
|
|
1098
|
-
print(
|
|
1099
|
-
f"\033[31m[聊天请求-{req_id}]\033[0m 关闭连接时出错: {str(e)}"
|
|
1100
|
-
)
|
|
1101
|
-
|
|
1102
1054
|
@self.prompt_server.routes.post(f"/{MODEL_API}/images")
|
|
1103
1055
|
async def image_generations(request):
|
|
1104
1056
|
try:
|
|
@@ -18,7 +18,7 @@ from .utils import (
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
async def fetch_all_models(api_key):
|
|
21
|
-
url = "
|
|
21
|
+
url = f"{BIZYAIR_SERVER_ADDRESS}/llm/models"
|
|
22
22
|
headers = {"accept": "application/json", "authorization": f"Bearer {api_key}"}
|
|
23
23
|
params = {"type": "text", "sub_type": "chat"}
|
|
24
24
|
|
|
@@ -8,6 +8,7 @@ import zlib
|
|
|
8
8
|
from typing import List, Tuple, Union
|
|
9
9
|
|
|
10
10
|
import numpy as np
|
|
11
|
+
from bizyengine.core.common.env_var import BIZYAIR_SERVER_ADDRESS
|
|
11
12
|
|
|
12
13
|
BIZYAIR_DEBUG = os.getenv("BIZYAIR_DEBUG", False)
|
|
13
14
|
|
|
@@ -135,7 +136,7 @@ def get_llm_response(
|
|
|
135
136
|
max_tokens: int = 1024,
|
|
136
137
|
temperature: float = 0.7,
|
|
137
138
|
):
|
|
138
|
-
api_url = "
|
|
139
|
+
api_url = f"{BIZYAIR_SERVER_ADDRESS}/chat/completions"
|
|
139
140
|
API_KEY = get_api_key()
|
|
140
141
|
headers = {
|
|
141
142
|
"accept": "application/json",
|
|
@@ -169,7 +170,7 @@ def get_vlm_response(
|
|
|
169
170
|
temperature: float = 0.7,
|
|
170
171
|
detail: str = "auto",
|
|
171
172
|
):
|
|
172
|
-
api_url = "
|
|
173
|
+
api_url = f"{BIZYAIR_SERVER_ADDRESS}/chat/completions"
|
|
173
174
|
API_KEY = get_api_key()
|
|
174
175
|
headers = {
|
|
175
176
|
"accept": "application/json",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.2.5
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bizyengine
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.5
|
|
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 +0,0 @@
|
|
|
1
|
-
1.2.4
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_advanced_refluxcontrol.py
RENAMED
|
File without changes
|
|
File without changes
|
{bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_comfyui_detail_daemon.py
RENAMED
|
File without changes
|
|
File without changes
|
{bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_comfyui_layerstyle_advance.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_differential_diffusion.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_ipadapter_plus/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/bizyair_extras/nodes_segment_anything_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/core/commands/processors/model_hosting_processor.py
RENAMED
|
File without changes
|
{bizyengine-1.2.4 → bizyengine-1.2.5}/bizyengine/core/commands/processors/prompt_processor.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|