Compare commits

..
Author SHA1 Message Date
bennykok 1486f97be1 proxy interrupt request 2025-08-28 15:25:55 -07:00
4 changed files with 19 additions and 25 deletions
-2
View File
@@ -2,8 +2,6 @@
Open source comfyui deployment platform, a `vercel` for generative workflow infra. (serverless hosted gpu with vertical intergation with comfyui)
Check out our latest lcoal demo -> https://github.com/comfy-deploy/comfyui-api-comfydeploy
> [!NOTE]
> Im looking for creative hacker to join ComfyDeploy's core team! DM me on [twitter](https://x.com/BennyKokMusic)
+16 -18
View File
@@ -579,6 +579,22 @@ async def comfy_deploy_run(request):
data = await request.json()
client_id = data.get("client_id")
# We proxy the request to Comfy Deploy, this is a native run
if "is_native_run" in data:
async with aiohttp.ClientSession() as session:
# pprint(data)
# headers = request.headers.copy()
# headers['Content-Type'] = 'application/json'
async with session.post(
data.get("native_run_api_endpoint"),
json=data,
headers={
"Content-Type": "application/json",
"Authorization": request.headers.get("Authorization"),
},
) as response:
data = await response.json()
# print(data)
if "cd_token" in data:
token = data["cd_token"]
@@ -590,24 +606,6 @@ async def comfy_deploy_run(request):
if len(parts) == 2 and parts[0].lower() == "bearer":
token = parts[1]
# We proxy the request to Comfy Deploy, this is a native run
if "is_native_run" in data:
async with aiohttp.ClientSession() as session:
data.pop("cd_token", None)
# pprint(data)
# headers = request.headers.copy()
# headers['Content-Type'] = 'application/json'
async with session.post(
data.get("native_run_api_endpoint"),
json=data,
headers={
"Content-Type": "application/json",
"Authorization": "Bearer " + token,
},
) as response:
data = await response.json()
# print(data)
# In older version, we use workflow_api, but this has inputs already swapped in nextjs frontend, which is tricky
workflow_api = data.get("workflow_api_raw")
# The prompt id generated from comfy deploy, can be None
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "comfyui-deploy"
description = "Open source comfyui deployment platform, a vercel for generative workflow infra."
version = "2.3.4"
version = "2.3.3"
license = { file = "LICENSE" }
dependencies = ["aiofiles", "pydantic", "opencv-python", "imageio-ffmpeg", "tabulate", "brotli"]
+2 -4
View File
@@ -2695,13 +2695,12 @@ api.fetchApi = async (route, options) => {
native_run_api_endpoint: info.native_run_api_endpoint,
gpu_event_id: info.gpu_event_id,
gpu: info.gpu,
cd_token: info.cd_token,
};
return await fetch("/comfyui-deploy/run", {
method: "POST",
headers: {
// Authorization: `Bearer ${info.cd_token}`,
Authorization: `Bearer ${info.cd_token}`,
"Content-Type": "application/json",
},
body: JSON.stringify(data),
@@ -2717,13 +2716,12 @@ api.fetchApi = async (route, options) => {
const body = JSON.parse(options.body);
const data = {
prompt_id: body.prompt_id,
cd_token: info.cd_token,
};
const original_response = await orginal_fetch_api.call(api, route, options);
await fetch("/comfyui-deploy/interrupt", {
method: "POST",
headers: {
// Authorization: `Bearer ${info.cd_token}`,
Authorization: `Bearer ${info.cd_token}`,
"Content-Type": "application/json",
},
body: JSON.stringify(data),