Merge pull request #3 from zxve/main

update
This commit is contained in:
jacklukai
2025-02-17 20:23:51 +08:00
committed by GitHub
2 changed files with 18 additions and 9 deletions
+9
View File
@@ -120,6 +120,7 @@ def verify_image_exists(path):
@server.PromptServer.instance.routes.post("/manager/tech_main")
async def tech_zhulu(request):
json_data = await request.json()
print(1, f"json_data={json_data}\n")
if "postData" in json_data and isinstance(json_data["postData"], dict):
json_data["postData"]["subdomain"] = subdomain
async with aiohttp.ClientSession() as session:
@@ -131,6 +132,8 @@ async def tech_zhulu(request):
+ "&techsid="
+ techsid + "&client_id=" + get_client_id()
)
print(2, f"upload_url={upload_url}\n")
if json_data["r"] == "comfyui.apiv2.upload":
output = json_data["postData"]["output"]
workflow = json_data["postData"]["workflow"]
@@ -173,11 +176,14 @@ async def tech_zhulu(request):
result["data"]["data"], dict
):
result_data = result["data"]["data"]
print(3, f"techsid={techsid}, code={result_data["code"]}\n")
if (
techsid != ""
and techsid != "init"
and result_data["code"] == 1
):
print(31, f"techsid={techsid}, code={result_data["code"]}\n")
await update_worker_flow(result_data["name"], output)
await update_worker_flow(
result_data["name"], workflow, "workflow/"
@@ -195,6 +201,7 @@ async def tech_zhulu(request):
)
else:
async with session.post(upload_url, json=json_data) as resp:
print(4, f"upload_url={upload_url}, json_data={json_data}\n")
if (
resp.status == 200
and resp.headers.get("Content-Type") == "application/json"
@@ -203,6 +210,7 @@ async def tech_zhulu(request):
other_api_data = await resp.json()
result = web.json_response(other_api_data)
if len(other_api_data["data"]["data"]["techsid"]) > len("12345"):
print(41, f"other_api_data={other_api_data}\n")
set_token(other_api_data["data"]["data"]["techsid"])
return result
except aiohttp.ContentTypeError:
@@ -220,6 +228,7 @@ async def tech_zhulu(request):
and "techsid" in result_data["data"]["data"]
):
if len(result_data["data"]["data"]["techsid"]) > len("12345"):
print(42, f"result_data={result_data}\n")
set_token(result_data["data"]["data"]["techsid"])
return web.json_response(result)
except json.JSONDecodeError as e:
+9 -9
View File
@@ -342,21 +342,21 @@ function getPostData(prompt) {
postData['cs_img_nodes'] = [];
if (HuiseN['cs_img1']) {
if (output[HuiseN['cs_img1'][0]].class_type == 'LoadImage') {
postData['cs_img_nodes'].push({node: HuiseN['cs_img1'][0], desc: HuiseN['cs_img1_desc']});
postData['cs_img_nodes'].push({node: HuiseN['cs_img1'][0], desc: HuiseN['cs_img1_desc'], value: ''});
} else {
return getMsgByEnglish('"custom_img1" can only connect "LoadImage" node');
}
}
if (HuiseN['cs_img2']) {
if (output[HuiseN['cs_img2'][0]].class_type == 'LoadImage') {
postData['cs_img_nodes'].push({node: HuiseN['cs_img2'][0], desc: HuiseN['cs_img2_desc']});
postData['cs_img_nodes'].push({node: HuiseN['cs_img2'][0], desc: HuiseN['cs_img2_desc'], value: ''});
} else {
return getMsgByEnglish('"custom_img2" can only connect "LoadImage" node');
}
}
if (HuiseN['cs_img3']) {
if (output[HuiseN['cs_img3'][0]].class_type == 'LoadImage') {
postData['cs_img_nodes'].push({node: HuiseN['cs_img3'][0], desc: HuiseN['cs_img3_desc']});
postData['cs_img_nodes'].push({node: HuiseN['cs_img3'][0], desc: HuiseN['cs_img3_desc'], value: ''});
} else {
return getMsgByEnglish('"custom_img3" can only connect "LoadImage" node');
}
@@ -365,21 +365,21 @@ function getPostData(prompt) {
postData['cs_video_nodes'] = [];
if (HuiseN['cs_video1']) {
if (output[HuiseN['cs_video1'][0]].class_type == 'VHS_LoadVideo') {
postData['cs_video_nodes'].push({node: HuiseN['cs_video1'][0], desc: HuiseN['cs_video1_desc']});
postData['cs_video_nodes'].push({node: HuiseN['cs_video1'][0], desc: HuiseN['cs_video1_desc'], value: ''});
} else {
return getMsgByEnglish('"custom_video1" can only connect "Load Video (Upload)" node');
}
}
if (HuiseN['cs_video2']) {
if (output[HuiseN['cs_video2'][0]].class_type == 'VHS_LoadVideo') {
postData['cs_video_nodes'].push({node: HuiseN['cs_video2'][0], desc: HuiseN['cs_video2_desc']});
postData['cs_video_nodes'].push({node: HuiseN['cs_video2'][0], desc: HuiseN['cs_video2_desc'], value: ''});
} else {
return getMsgByEnglish('"custom_video2" can only connect "Load Video (Upload)" node');
}
}
if (HuiseN['cs_video3']) {
if (output[HuiseN['cs_video3'][0]].class_type == 'VHS_LoadVideo') {
postData['cs_video_nodes'].push({node: HuiseN['cs_video3'][0], desc: HuiseN['cs_video3_desc']});
postData['cs_video_nodes'].push({node: HuiseN['cs_video3'][0], desc: HuiseN['cs_video3_desc'], value: ''});
} else {
return getMsgByEnglish('"custom_video3" can only connect "Load Video (Upload)" node');
}
@@ -388,21 +388,21 @@ function getPostData(prompt) {
postData['cs_text_nodes'] = [];
if (HuiseN['cs_text1']) {
if (output[HuiseN['cs_text1'][0]] && typeof output[HuiseN['cs_text1'][0]].inputs !== 'undefined' && typeof output[HuiseN['cs_text1'][0]].inputs.text !== 'undefined') {
postData['cs_text_nodes'].push({node: HuiseN['cs_text1'][0], desc: HuiseN['cs_text1_desc']});
postData['cs_text_nodes'].push({node: HuiseN['cs_text1'][0], desc: HuiseN['cs_text1_desc'], value: ''});
} else {
return getMsgByEnglish('"custom_text1" can only connect "textInput" node');
}
}
if (HuiseN['cs_text2']) {
if (output[HuiseN['cs_text2'][0]] && typeof output[HuiseN['cs_text2'][0]].inputs !== 'undefined' && typeof output[HuiseN['cs_text2'][0]].inputs.text !== 'undefined') {
postData['cs_text_nodes'].push({node: HuiseN['cs_text2'][0], desc: HuiseN['cs_text2_desc']});
postData['cs_text_nodes'].push({node: HuiseN['cs_text2'][0], desc: HuiseN['cs_text2_desc'], value: ''});
} else {
return getMsgByEnglish('"custom_text2" can only connect "textInput" node');
}
}
if (HuiseN['cs_text3']) {
if (output[HuiseN['cs_text3'][0]] && typeof output[HuiseN['cs_text3'][0]].inputs !== 'undefined' && typeof output[HuiseN['cs_text3'][0]].inputs.text !== 'undefined') {
postData['cs_text_nodes'].push({node: HuiseN['cs_text3'][0], desc: HuiseN['cs_text3_desc']});
postData['cs_text_nodes'].push({node: HuiseN['cs_text3'][0], desc: HuiseN['cs_text3_desc'], value: ''});
} else {
return getMsgByEnglish('"custom_text3" can only connect "textInput" node');
}