n8n-nodes-hjhcomfyui

0.0.50 • Public • Published

n8n-nodes-hjhcomfyui

n8n-nodes-hjhcomfyui

function getReturnPostData1(data: any) {
	let outputs = data.outputs;
	let prompt = data.prompt[2];
	let status = data.status;

	if(status.status_str == "success") {
		let outputId = null;
		for (let id in prompt) {
			if (prompt[id]["class_type"] == "ReturnPost") {
				outputId = id;
				break;
			}
		}

		if (outputId) {
			try {
				let res = outputs["outputId"]["results"];
				if(typeof(res) == "string") {
					res = JSON.parse(res);
				}

				return res[0]["data"];
			} catch (e) {
				return [];
			}
		}
	} else {
		let ret = {
			"code": 400,
			"data": {},
			"message": "HjhComfyUI workflow execution failed",
		};
		let executionError = status["messages"][2][1];
		data = {
			"node_type": executionError["node_type"],
			"exception_type": executionError["exception_type"],
		};
		ret["data"] = data;
		ret["message"] = executionError["exception_message"];
		return ret;
	}
	
	return [];
}

Package Sidebar

Install

npm i n8n-nodes-hjhcomfyui

Weekly Downloads

1,243

Version

0.0.50

License

MIT

Unpacked Size

183 kB

Total Files

31

Last publish

Collaborators

  • yiluxiangbei