Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c13828af56 | ||
|
|
ffda951cfa | ||
|
|
ac0d8ba725 | ||
|
|
31c38ddb9b | ||
|
|
2f2c63fa11 | ||
|
|
7675c5ba90 | ||
|
|
7d65d23f84 | ||
|
|
a91edf6371 | ||
|
|
967709dd07 | ||
|
|
07a827d56b | ||
|
|
7f6eea361e |
@@ -2,6 +2,8 @@
|
||||
|
||||
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)
|
||||
|
||||
|
||||
@@ -672,6 +672,14 @@ async def comfy_deploy_run(request):
|
||||
return web.json_response(res, status=status)
|
||||
|
||||
|
||||
@server.PromptServer.instance.routes.post("/comfyui-deploy/interrupt")
|
||||
async def interrupt_prompt(request):
|
||||
data = await request.json()
|
||||
prompt_id = data.get("prompt_id")
|
||||
await update_run(prompt_id, Status.CANCELLED)
|
||||
return web.json_response({"message": "Prompt interrupted"}, status=200)
|
||||
|
||||
|
||||
async def stream_prompt(data, token):
|
||||
# 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")
|
||||
@@ -2995,6 +3003,7 @@ async def create_workflow_proxy(request):
|
||||
name = data.get("name")
|
||||
workflow_json = data.get("workflow_json")
|
||||
workflow_api = data.get("workflow_api")
|
||||
machine_id = data.get("machine_id")
|
||||
api_url = data.get("api_url", "https://api.comfydeploy.com")
|
||||
|
||||
auth_header = request.headers.get("Authorization")
|
||||
@@ -3014,6 +3023,7 @@ async def create_workflow_proxy(request):
|
||||
"name": name,
|
||||
"workflow_json": json.dumps(workflow_json),
|
||||
"workflow_api": json.dumps(workflow_api),
|
||||
"machine_id": machine_id,
|
||||
}
|
||||
|
||||
try:
|
||||
@@ -3136,3 +3146,498 @@ async def get_workflow_proxy(request):
|
||||
return web.json_response(json_data, status=response.status)
|
||||
except Exception as e:
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
# fetch workflow versions (infinite scroll support)
|
||||
@server.PromptServer.instance.routes.get("/comfyui-deploy/workflow/versions")
|
||||
async def get_workflow_versions_proxy(request):
|
||||
workflow_id = request.rel_url.query.get("workflow_id")
|
||||
api_url = request.rel_url.query.get("api_url", "https://api.comfydeploy.com")
|
||||
search = request.rel_url.query.get("search", "")
|
||||
limit = request.rel_url.query.get("limit", "20")
|
||||
offset = request.rel_url.query.get("offset", "0")
|
||||
auth_header = request.headers.get("Authorization")
|
||||
|
||||
if not auth_header:
|
||||
return web.json_response(
|
||||
{"error": "Authorization header is required"}, status=401
|
||||
)
|
||||
|
||||
# Build target URL with query params
|
||||
params = {"limit": limit, "offset": offset}
|
||||
if search:
|
||||
params["search"] = search
|
||||
|
||||
query = urlencode(params)
|
||||
target_url = f"{api_url}/api/workflow/{workflow_id}/versions"
|
||||
if query:
|
||||
target_url += f"?{query}"
|
||||
|
||||
try:
|
||||
await ensure_client_session()
|
||||
async with client_session.get(
|
||||
target_url, headers={"Authorization": auth_header}
|
||||
) as response:
|
||||
json_data = await response.json()
|
||||
return web.json_response(json_data, status=response.status)
|
||||
except Exception as e:
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
# fetch a specific workflow version json
|
||||
@server.PromptServer.instance.routes.get("/comfyui-deploy/workflow/version")
|
||||
async def get_workflow_version_proxy(request):
|
||||
workflow_id = request.rel_url.query.get("workflow_id")
|
||||
version = request.rel_url.query.get("version")
|
||||
api_url = request.rel_url.query.get("api_url", "https://api.comfydeploy.com")
|
||||
auth_header = request.headers.get("Authorization")
|
||||
|
||||
if not auth_header:
|
||||
return web.json_response(
|
||||
{"error": "Authorization header is required"}, status=401
|
||||
)
|
||||
|
||||
target_url = f"{api_url}/api/workflow/{workflow_id}/version/{version}"
|
||||
|
||||
try:
|
||||
await ensure_client_session()
|
||||
async with client_session.get(
|
||||
target_url, headers={"Authorization": auth_header}
|
||||
) as response:
|
||||
json_data = await response.json()
|
||||
return web.json_response(json_data, status=response.status)
|
||||
except Exception as e:
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
# for getting a machine by id
|
||||
@server.PromptServer.instance.routes.get("/comfyui-deploy/machine")
|
||||
async def get_machine_proxy(request):
|
||||
machine_id = request.rel_url.query.get("machine_id")
|
||||
api_url = request.rel_url.query.get("api_url", "https://api.comfydeploy.com")
|
||||
auth_header = request.headers.get("Authorization")
|
||||
|
||||
if not auth_header:
|
||||
return web.json_response(
|
||||
{"error": "Authorization header is required"}, status=401
|
||||
)
|
||||
|
||||
target_url = f"{api_url}/api/machine/{machine_id}"
|
||||
|
||||
try:
|
||||
await ensure_client_session()
|
||||
async with client_session.get(
|
||||
target_url, headers={"Authorization": auth_header}
|
||||
) as response:
|
||||
json_data = await response.json()
|
||||
return web.json_response(json_data, status=response.status)
|
||||
except Exception as e:
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
# for fetching docker steps from current snapshot
|
||||
@server.PromptServer.instance.routes.post("/comfyui-deploy/snapshot-to-docker")
|
||||
async def snapshot_to_docker_proxy(request):
|
||||
data = await request.json()
|
||||
snapshot = data.get("snapshot")
|
||||
api_url = data.get("api_url", "https://api.comfydeploy.com")
|
||||
auth_header = request.headers.get("Authorization")
|
||||
|
||||
if not auth_header:
|
||||
return web.json_response(
|
||||
{"error": "Authorization header is required"}, status=401
|
||||
)
|
||||
|
||||
target_url = f"{api_url}/api/snapshot-to-docker"
|
||||
|
||||
request_body = snapshot
|
||||
|
||||
try:
|
||||
await ensure_client_session()
|
||||
async with client_session.post(
|
||||
target_url, json=request_body, headers={"Authorization": auth_header}
|
||||
) as response:
|
||||
json_data = await response.json()
|
||||
return web.json_response(json_data, status=response.status)
|
||||
except Exception as e:
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
# update a serverless machine with machine id
|
||||
@server.PromptServer.instance.routes.post("/comfyui-deploy/machine/update")
|
||||
async def update_machine_proxy(request):
|
||||
data = await request.json()
|
||||
machine_id = data.get("machine_id")
|
||||
comfyui_version = data.get("comfyui_version", None)
|
||||
docker_steps = data.get("docker_steps")
|
||||
api_url = data.get("api_url", "https://api.comfydeploy.com")
|
||||
auth_header = request.headers.get("Authorization")
|
||||
|
||||
if not auth_header:
|
||||
return web.json_response(
|
||||
{"error": "Authorization header is required"}, status=401
|
||||
)
|
||||
|
||||
target_url = f"{api_url}/api/machine/serverless/{machine_id}"
|
||||
|
||||
request_body = {"docker_command_steps": docker_steps}
|
||||
|
||||
if comfyui_version:
|
||||
request_body["comfyui_version"] = comfyui_version
|
||||
|
||||
try:
|
||||
await ensure_client_session()
|
||||
async with client_session.patch(
|
||||
target_url, json=request_body, headers={"Authorization": auth_header}
|
||||
) as response:
|
||||
json_data = await response.json()
|
||||
return web.json_response(json_data, status=response.status)
|
||||
except Exception as e:
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
@server.PromptServer.instance.routes.post("/comfyui-deploy/machine/create")
|
||||
async def create_machine_proxy(request):
|
||||
data = await request.json()
|
||||
name = data.get("name")
|
||||
docker_command_steps = data.get("docker_command_steps")
|
||||
comfyui_version = data.get("comfyui_version")
|
||||
api_url = data.get("api_url", "https://api.comfydeploy.com")
|
||||
auth_header = request.headers.get("Authorization")
|
||||
|
||||
if not auth_header:
|
||||
return web.json_response(
|
||||
{"error": "Authorization header is required"}, status=401
|
||||
)
|
||||
|
||||
target_url = f"{api_url}/api/machine/serverless"
|
||||
|
||||
request_body = {
|
||||
"name": name,
|
||||
"docker_command_steps": docker_command_steps,
|
||||
"comfyui_version": comfyui_version,
|
||||
"gpu": "A10G",
|
||||
}
|
||||
|
||||
try:
|
||||
await ensure_client_session()
|
||||
async with client_session.post(
|
||||
target_url, json=request_body, headers={"Authorization": auth_header}
|
||||
) as response:
|
||||
json_data = await response.json()
|
||||
return web.json_response(json_data, status=response.status)
|
||||
except Exception as e:
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
# get latest comfyui version
|
||||
@server.PromptServer.instance.routes.get("/comfyui-deploy/comfyui-version")
|
||||
async def get_comfyui_version_proxy(request):
|
||||
api_url = request.rel_url.query.get("api_url", "https://api.comfydeploy.com")
|
||||
auth_header = request.headers.get("Authorization")
|
||||
|
||||
if not auth_header:
|
||||
return web.json_response(
|
||||
{"error": "Authorization header is required"}, status=401
|
||||
)
|
||||
|
||||
target_url = f"{api_url}/api/latest-hashes"
|
||||
|
||||
try:
|
||||
await ensure_client_session()
|
||||
async with client_session.get(
|
||||
target_url, headers={"Authorization": auth_header}
|
||||
) as response:
|
||||
json_data = await response.json()
|
||||
return web.json_response(json_data, status=response.status)
|
||||
except Exception as e:
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
# Proxy: generate single-part upload URL
|
||||
@server.PromptServer.instance.routes.post(
|
||||
"/comfyui-deploy/volume/file/generate-upload-url"
|
||||
)
|
||||
async def proxy_generate_upload_url(request):
|
||||
data = await request.json()
|
||||
api_url = data.get("api_url", "https://api.comfydeploy.com")
|
||||
auth_header = request.headers.get("Authorization")
|
||||
|
||||
if not auth_header:
|
||||
return web.json_response(
|
||||
{"error": "Authorization header is required"}, status=401
|
||||
)
|
||||
|
||||
target_url = f"{api_url}/api/volume/file/generate-upload-url"
|
||||
|
||||
try:
|
||||
await ensure_client_session()
|
||||
async with client_session.post(
|
||||
target_url,
|
||||
json={
|
||||
"filename": data.get("filename"),
|
||||
"contentType": data.get("contentType"),
|
||||
"size": data.get("size"),
|
||||
},
|
||||
headers={"Authorization": auth_header},
|
||||
) as response:
|
||||
json_data = await response.json()
|
||||
return web.json_response(json_data, status=response.status)
|
||||
except Exception as e:
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
# Proxy: initiate multipart upload
|
||||
@server.PromptServer.instance.routes.post(
|
||||
"/comfyui-deploy/volume/file/initiate-multipart-upload"
|
||||
)
|
||||
async def proxy_initiate_multipart_upload(request):
|
||||
data = await request.json()
|
||||
api_url = data.get("api_url", "https://api.comfydeploy.com")
|
||||
auth_header = request.headers.get("Authorization")
|
||||
|
||||
if not auth_header:
|
||||
return web.json_response(
|
||||
{"error": "Authorization header is required"}, status=401
|
||||
)
|
||||
|
||||
target_url = f"{api_url}/api/volume/file/initiate-multipart-upload"
|
||||
|
||||
try:
|
||||
await ensure_client_session()
|
||||
async with client_session.post(
|
||||
target_url,
|
||||
json={
|
||||
"filename": data.get("filename"),
|
||||
"contentType": data.get("contentType"),
|
||||
"size": data.get("size"),
|
||||
},
|
||||
headers={"Authorization": auth_header},
|
||||
) as response:
|
||||
json_data = await response.json()
|
||||
return web.json_response(json_data, status=response.status)
|
||||
except Exception as e:
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
# Proxy: generate part upload URL
|
||||
@server.PromptServer.instance.routes.post(
|
||||
"/comfyui-deploy/volume/file/generate-part-upload-url"
|
||||
)
|
||||
async def proxy_generate_part_upload_url(request):
|
||||
data = await request.json()
|
||||
api_url = data.get("api_url", "https://api.comfydeploy.com")
|
||||
auth_header = request.headers.get("Authorization")
|
||||
|
||||
if not auth_header:
|
||||
return web.json_response(
|
||||
{"error": "Authorization header is required"}, status=401
|
||||
)
|
||||
|
||||
target_url = f"{api_url}/api/volume/file/generate-part-upload-url"
|
||||
|
||||
try:
|
||||
await ensure_client_session()
|
||||
async with client_session.post(
|
||||
target_url,
|
||||
json={
|
||||
"uploadId": data.get("uploadId"),
|
||||
"key": data.get("key"),
|
||||
"partNumber": data.get("partNumber"),
|
||||
},
|
||||
headers={"Authorization": auth_header},
|
||||
) as response:
|
||||
json_data = await response.json()
|
||||
return web.json_response(json_data, status=response.status)
|
||||
except Exception as e:
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
# Proxy: complete multipart upload
|
||||
@server.PromptServer.instance.routes.post(
|
||||
"/comfyui-deploy/volume/file/complete-multipart-upload"
|
||||
)
|
||||
async def proxy_complete_multipart_upload(request):
|
||||
data = await request.json()
|
||||
api_url = data.get("api_url", "https://api.comfydeploy.com")
|
||||
auth_header = request.headers.get("Authorization")
|
||||
|
||||
if not auth_header:
|
||||
return web.json_response(
|
||||
{"error": "Authorization header is required"}, status=401
|
||||
)
|
||||
|
||||
target_url = f"{api_url}/api/volume/file/complete-multipart-upload"
|
||||
|
||||
try:
|
||||
await ensure_client_session()
|
||||
async with client_session.post(
|
||||
target_url,
|
||||
json={
|
||||
"uploadId": data.get("uploadId"),
|
||||
"key": data.get("key"),
|
||||
"parts": data.get("parts"),
|
||||
},
|
||||
headers={"Authorization": auth_header},
|
||||
) as response:
|
||||
json_data = await response.json()
|
||||
return web.json_response(json_data, status=response.status)
|
||||
except Exception as e:
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
# Proxy: abort multipart upload
|
||||
@server.PromptServer.instance.routes.post(
|
||||
"/comfyui-deploy/volume/file/abort-multipart-upload"
|
||||
)
|
||||
async def proxy_abort_multipart_upload(request):
|
||||
data = await request.json()
|
||||
api_url = data.get("api_url", "https://api.comfydeploy.com")
|
||||
auth_header = request.headers.get("Authorization")
|
||||
|
||||
if not auth_header:
|
||||
return web.json_response(
|
||||
{"error": "Authorization header is required"}, status=401
|
||||
)
|
||||
|
||||
target_url = f"{api_url}/api/volume/file/abort-multipart-upload"
|
||||
|
||||
try:
|
||||
await ensure_client_session()
|
||||
async with client_session.post(
|
||||
target_url,
|
||||
json={
|
||||
"uploadId": data.get("uploadId"),
|
||||
"key": data.get("key"),
|
||||
},
|
||||
headers={"Authorization": auth_header},
|
||||
) as response:
|
||||
json_data = await response.json()
|
||||
return web.json_response(json_data, status=response.status)
|
||||
except Exception as e:
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
# Proxy: add model (unified endpoint)
|
||||
@server.PromptServer.instance.routes.post("/comfyui-deploy/volume/model")
|
||||
async def proxy_add_model(request):
|
||||
data = await request.json()
|
||||
api_url = data.get("api_url", "https://api.comfydeploy.com")
|
||||
auth_header = request.headers.get("Authorization")
|
||||
|
||||
if not auth_header:
|
||||
return web.json_response(
|
||||
{"error": "Authorization header is required"}, status=401
|
||||
)
|
||||
|
||||
target_url = f"{api_url}/api/volume/model"
|
||||
|
||||
# pass body through but remove api_url key
|
||||
forward_body = dict(data)
|
||||
if "api_url" in forward_body:
|
||||
forward_body.pop("api_url")
|
||||
|
||||
try:
|
||||
await ensure_client_session()
|
||||
async with client_session.post(
|
||||
target_url, json=forward_body, headers={"Authorization": auth_header}
|
||||
) as response:
|
||||
json_data = await response.json()
|
||||
return web.json_response(json_data, status=response.status)
|
||||
except Exception as e:
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
# FS: stat file (size)
|
||||
@server.PromptServer.instance.routes.get("/comfyui-deploy/fs/stat")
|
||||
async def fs_stat(request):
|
||||
try:
|
||||
import os
|
||||
|
||||
file_path = request.rel_url.query.get("path")
|
||||
if not file_path:
|
||||
return web.json_response({"error": "path is required"}, status=400)
|
||||
|
||||
# Basic safeguard: ensure it's a ComfyUI models path
|
||||
if "/models/" not in file_path:
|
||||
return web.json_response({"error": "invalid path"}, status=400)
|
||||
|
||||
st = os.stat(file_path)
|
||||
return web.json_response({"size": st.st_size})
|
||||
except FileNotFoundError:
|
||||
return web.json_response({"error": "not found"}, status=404)
|
||||
except Exception as e:
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
# Upload a multipart part directly from machine filesystem to S3 upload URL
|
||||
@server.PromptServer.instance.routes.post(
|
||||
"/comfyui-deploy/volume/file/upload-part-from-path"
|
||||
)
|
||||
async def upload_part_from_path(request):
|
||||
try:
|
||||
import os
|
||||
import io
|
||||
|
||||
data = await request.json()
|
||||
file_path = data.get("filePath")
|
||||
upload_url = data.get("uploadUrl")
|
||||
start = int(data.get("start", 0))
|
||||
end = int(data.get("end", 0))
|
||||
if not file_path or not upload_url:
|
||||
return web.json_response(
|
||||
{"error": "filePath and uploadUrl are required"}, status=400
|
||||
)
|
||||
if "/models/" not in file_path:
|
||||
return web.json_response({"error": "invalid filePath"}, status=400)
|
||||
if end <= start:
|
||||
return web.json_response({"error": "invalid byte range"}, status=400)
|
||||
|
||||
size = end - start
|
||||
|
||||
await ensure_client_session()
|
||||
|
||||
# Important: S3 pre-signed part uploads do not support chunked transfer
|
||||
# Buffer the exact part into memory to provide a Content-Length header
|
||||
buffer = bytearray()
|
||||
chunk_size = 4 * 1024 * 1024
|
||||
with open(file_path, "rb") as f:
|
||||
f.seek(start)
|
||||
remaining = size
|
||||
while remaining > 0:
|
||||
to_read = chunk_size if remaining >= chunk_size else remaining
|
||||
chunk = f.read(to_read)
|
||||
if not chunk:
|
||||
break
|
||||
buffer.extend(chunk)
|
||||
remaining -= len(chunk)
|
||||
|
||||
if len(buffer) != size:
|
||||
return web.json_response(
|
||||
{
|
||||
"error": "read size mismatch",
|
||||
"expected": size,
|
||||
"actual": len(buffer),
|
||||
},
|
||||
status=500,
|
||||
)
|
||||
|
||||
headers = {
|
||||
"Content-Length": str(size),
|
||||
"Content-Type": "application/octet-stream",
|
||||
}
|
||||
|
||||
async with client_session.put(
|
||||
upload_url, data=bytes(buffer), headers=headers
|
||||
) as resp:
|
||||
text = await resp.text()
|
||||
if resp.status < 200 or resp.status >= 300:
|
||||
return web.json_response(
|
||||
{"error": f"upload failed: {resp.status}", "body": text},
|
||||
status=resp.status,
|
||||
)
|
||||
etag = resp.headers.get("ETag") or resp.headers.get("etag") or ""
|
||||
etag = etag.replace('"', "")
|
||||
return web.json_response({"eTag": etag, "bytesSent": size})
|
||||
except Exception as e:
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
@@ -18,6 +18,7 @@ class Status(Enum):
|
||||
SUCCESS = "success"
|
||||
FAILED = "failed"
|
||||
UPLOADING = "uploading"
|
||||
CANCELLED = "cancelled"
|
||||
|
||||
|
||||
class StreamingPrompt(BaseModel):
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "comfyui-deploy"
|
||||
description = "Open source comfyui deployment platform, a vercel for generative workflow infra."
|
||||
version = "2.2.1"
|
||||
version = "2.3.6"
|
||||
license = { file = "LICENSE" }
|
||||
dependencies = ["aiofiles", "pydantic", "opencv-python", "imageio-ffmpeg", "tabulate", "brotli"]
|
||||
|
||||
|
||||
+1062
-344
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,68 @@
|
||||
// Snapshot Utilities
|
||||
// Centralized snapshot fetching with ComfyUI version fallback
|
||||
|
||||
/**
|
||||
* Fetches the current snapshot with ComfyUI version fallback
|
||||
* If the snapshot response has null comfyui field, it will fetch the latest ComfyUI version
|
||||
* and update the snapshot with the comfyui_hash
|
||||
*
|
||||
* @param {Function} getDataFn - Function that returns { apiKey, apiUrl } for ComfyUI version API calls
|
||||
* @returns {Promise<Object>} - The snapshot data with comfyui field populated
|
||||
*/
|
||||
export async function fetchSnapshot(getDataFn = null) {
|
||||
try {
|
||||
// Fetch the current snapshot
|
||||
const response = await fetch("/snapshot/get_current");
|
||||
if (!response.ok) {
|
||||
throw new Error(`Snapshot fetch failed: ${response.status}`);
|
||||
}
|
||||
|
||||
const snapshot = await response.json();
|
||||
|
||||
// Check if comfyui field is null and we have getDataFn for fallback
|
||||
if (snapshot.comfyui === null && getDataFn) {
|
||||
console.log(
|
||||
"ComfyUI version is null in snapshot, fetching latest version..."
|
||||
);
|
||||
|
||||
try {
|
||||
const data = getDataFn();
|
||||
if (data && data.apiKey) {
|
||||
const comfyuiVersionResponse = await fetch(
|
||||
`/comfyui-deploy/comfyui-version?api_url=${encodeURIComponent(
|
||||
data.apiUrl || "https://api.comfydeploy.com"
|
||||
)}`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${data.apiKey}`,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
if (comfyuiVersionResponse.ok) {
|
||||
const versionData = await comfyuiVersionResponse.json();
|
||||
if (versionData.comfyui_hash) {
|
||||
console.log(
|
||||
`Using ComfyUI hash from API: ${versionData.comfyui_hash}`
|
||||
);
|
||||
snapshot.comfyui = versionData.comfyui_hash;
|
||||
}
|
||||
} else {
|
||||
console.warn(
|
||||
"Failed to fetch ComfyUI version from API:",
|
||||
comfyuiVersionResponse.status
|
||||
);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn("Error fetching ComfyUI version fallback:", error);
|
||||
// Continue with original snapshot even if fallback fails
|
||||
}
|
||||
}
|
||||
|
||||
return snapshot;
|
||||
} catch (error) {
|
||||
console.error("Error fetching snapshot:", error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
+957
-3
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user