Compare commits
4
Commits
v2.3.9
...
benny/fix-beam
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3cb449ae42 | ||
|
|
6a888548ef | ||
|
|
99a953c8e7 | ||
|
|
e0447f0865 |
+18
-16
@@ -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
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user