Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions ai_diffusion/backend/comfy_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,14 +269,17 @@ async def refresh(self):
async for __ in self.discover_models(refresh=True):
pass

async def _head(self, op: str, timeout: float | None = 60):
return await self._requests.head(f"{self.url}/{op}", timeout=timeout)

async def _get(self, op: str, timeout: float | None = 60):
return await self._requests.get(f"{self.url}/{op}", timeout=timeout)

async def _post(self, op: str, data: dict):
return await self._requests.post(f"{self.url}/{op}", data)

async def _put(self, op: str, data: bytes):
return await self._requests.put(f"{self.url}/{op}", data)
async def _put(self, op: str, data: bytes, expect_continue: bool = False):
return await self._requests.put(f"{self.url}/{op}", data, expect_continue=expect_continue)

async def enqueue(self, work: WorkflowInput, front: bool = False):
job = JobInfo.create(work)
Expand Down Expand Up @@ -548,7 +551,7 @@ async def _transfer_result_image(self, id: str):
async def upload_images(self, image_data: dict[str, bytes]):
for id, data in image_data.items():
try:
await self._put(f"api/etn/image/{id}", data)
await self._put(f"api/etn/image/{id}", data, expect_continue=True)
except Exception as e:
log.error(f"Error uploading image {id}: {e!s}")
raise RuntimeError(f"Error uploading input image to ComfyUI: {e!s}") from e
Expand Down
Loading