Compare commits

...
Author SHA1 Message Date
bennykok 3cb449ae42 fix 2025-09-02 19:02:08 -07:00
bennykok 6a888548ef fix 2025-09-02 18:49:38 -07:00
bennykok 99a953c8e7 fix 2025-09-02 18:28:37 -07:00
bennykok e0447f0865 fall back to beam token setup -> cd_token 2025-09-02 18:19:18 -07:00
2 changed files with 22 additions and 18 deletions
+18 -16
View File
@@ -579,22 +579,6 @@ 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"]
@@ -606,6 +590,24 @@ 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
+4 -2
View File
@@ -2695,12 +2695,13 @@ 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),
@@ -2716,12 +2717,13 @@ 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),