From f74e352f96cd411f83b16b5f17a879b663d6e4cf Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue, 20 Feb 2024 22:15:01 +1100 Subject: [PATCH] feat(bulk_download): update response model, messages --- invokeai/app/api/routers/images.py | 13 ++++++------- .../services/bulk_download/bulk_download_common.py | 5 +---- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/invokeai/app/api/routers/images.py b/invokeai/app/api/routers/images.py index c3504b104d..dc8a04b711 100644 --- a/invokeai/app/api/routers/images.py +++ b/invokeai/app/api/routers/images.py @@ -375,9 +375,11 @@ async def unstar_images_in_list( class ImagesDownloaded(BaseModel): 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( @@ -389,7 +391,7 @@ async def download_images_from_list( default=None, description="The list of names of images to download", embed=True ), 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: 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, bulk_download_item_id, ) - return ImagesDownloaded( - response="Your images are preparing to be downloaded", - bulk_download_item_name=bulk_download_item_id + ".zip", - ) + return ImagesDownloaded(bulk_download_item_name=bulk_download_item_id + ".zip") @images_router.api_route( diff --git a/invokeai/app/services/bulk_download/bulk_download_common.py b/invokeai/app/services/bulk_download/bulk_download_common.py index 37b80073be..68724eb228 100644 --- a/invokeai/app/services/bulk_download/bulk_download_common.py +++ b/invokeai/app/services/bulk_download/bulk_download_common.py @@ -20,9 +20,6 @@ class BulkDownloadTargetException(BulkDownloadException): class BulkDownloadParametersException(BulkDownloadException): """Exception raised when a bulk download parameter is invalid.""" - def __init__( - self, - message="The bulk download parameters are invalid, either an array of image names or a board id must be provided", - ): + def __init__(self, message="No image names or board ID provided"): super().__init__(message) self.message = message