mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(bulk_download): update response model, messages
This commit is contained in:
parent
6a6958f19b
commit
f74e352f96
@ -375,9 +375,11 @@ async def unstar_images_in_list(
|
|||||||
|
|
||||||
class ImagesDownloaded(BaseModel):
|
class ImagesDownloaded(BaseModel):
|
||||||
response: Optional[str] = Field(
|
response: Optional[str] = Field(
|
||||||
description="If defined, the message to display to the user when images begin downloading"
|
default=None, description="The message to display to the user when images begin downloading"
|
||||||
|
)
|
||||||
|
bulk_download_item_name: Optional[str] = Field(
|
||||||
|
default=None, description="The name of the bulk download item for which events will be emitted"
|
||||||
)
|
)
|
||||||
bulk_download_item_name: str = Field(description="The bulk download item name of the bulk download item")
|
|
||||||
|
|
||||||
|
|
||||||
@images_router.post(
|
@images_router.post(
|
||||||
@ -389,7 +391,7 @@ async def download_images_from_list(
|
|||||||
default=None, description="The list of names of images to download", embed=True
|
default=None, description="The list of names of images to download", embed=True
|
||||||
),
|
),
|
||||||
board_id: Optional[str] = Body(
|
board_id: Optional[str] = Body(
|
||||||
default=None, description="The board from which image should be downloaded from", embed=True
|
default=None, description="The board from which image should be downloaded", embed=True
|
||||||
),
|
),
|
||||||
) -> ImagesDownloaded:
|
) -> ImagesDownloaded:
|
||||||
if (image_names is None or len(image_names) == 0) and board_id is None:
|
if (image_names is None or len(image_names) == 0) and board_id is None:
|
||||||
@ -402,10 +404,7 @@ async def download_images_from_list(
|
|||||||
board_id,
|
board_id,
|
||||||
bulk_download_item_id,
|
bulk_download_item_id,
|
||||||
)
|
)
|
||||||
return ImagesDownloaded(
|
return ImagesDownloaded(bulk_download_item_name=bulk_download_item_id + ".zip")
|
||||||
response="Your images are preparing to be downloaded",
|
|
||||||
bulk_download_item_name=bulk_download_item_id + ".zip",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@images_router.api_route(
|
@images_router.api_route(
|
||||||
|
@ -20,9 +20,6 @@ class BulkDownloadTargetException(BulkDownloadException):
|
|||||||
class BulkDownloadParametersException(BulkDownloadException):
|
class BulkDownloadParametersException(BulkDownloadException):
|
||||||
"""Exception raised when a bulk download parameter is invalid."""
|
"""Exception raised when a bulk download parameter is invalid."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(self, message="No image names or board ID provided"):
|
||||||
self,
|
|
||||||
message="The bulk download parameters are invalid, either an array of image names or a board id must be provided",
|
|
||||||
):
|
|
||||||
super().__init__(message)
|
super().__init__(message)
|
||||||
self.message = message
|
self.message = message
|
||||||
|
Loading…
Reference in New Issue
Block a user