mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(api,db): allow creating an image with a board_id
This commit is contained in:
parent
6f7d221f57
commit
896b77cf56
@ -40,6 +40,9 @@ async def upload_image(
|
|||||||
response: Response,
|
response: Response,
|
||||||
image_category: ImageCategory = Query(description="The category of the image"),
|
image_category: ImageCategory = Query(description="The category of the image"),
|
||||||
is_intermediate: bool = Query(description="Whether this is an intermediate image"),
|
is_intermediate: bool = Query(description="Whether this is an intermediate image"),
|
||||||
|
board_id: Optional[str] = Query(
|
||||||
|
default=None, description="The board to add this image to, if any"
|
||||||
|
),
|
||||||
session_id: Optional[str] = Query(
|
session_id: Optional[str] = Query(
|
||||||
default=None, description="The session ID associated with this upload, if any"
|
default=None, description="The session ID associated with this upload, if any"
|
||||||
),
|
),
|
||||||
@ -62,6 +65,7 @@ async def upload_image(
|
|||||||
image_origin=ResourceOrigin.EXTERNAL,
|
image_origin=ResourceOrigin.EXTERNAL,
|
||||||
image_category=image_category,
|
image_category=image_category,
|
||||||
session_id=session_id,
|
session_id=session_id,
|
||||||
|
board_id=board_id,
|
||||||
is_intermediate=is_intermediate,
|
is_intermediate=is_intermediate,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -52,6 +52,7 @@ class ImageServiceABC(ABC):
|
|||||||
image_category: ImageCategory,
|
image_category: ImageCategory,
|
||||||
node_id: Optional[str] = None,
|
node_id: Optional[str] = None,
|
||||||
session_id: Optional[str] = None,
|
session_id: Optional[str] = None,
|
||||||
|
board_id: Optional[str] = None,
|
||||||
is_intermediate: bool = False,
|
is_intermediate: bool = False,
|
||||||
metadata: Optional[dict] = None,
|
metadata: Optional[dict] = None,
|
||||||
) -> ImageDTO:
|
) -> ImageDTO:
|
||||||
@ -174,6 +175,7 @@ class ImageService(ImageServiceABC):
|
|||||||
image_category: ImageCategory,
|
image_category: ImageCategory,
|
||||||
node_id: Optional[str] = None,
|
node_id: Optional[str] = None,
|
||||||
session_id: Optional[str] = None,
|
session_id: Optional[str] = None,
|
||||||
|
board_id: Optional[str] = None,
|
||||||
is_intermediate: bool = False,
|
is_intermediate: bool = False,
|
||||||
metadata: Optional[dict] = None,
|
metadata: Optional[dict] = None,
|
||||||
) -> ImageDTO:
|
) -> ImageDTO:
|
||||||
@ -215,6 +217,11 @@ class ImageService(ImageServiceABC):
|
|||||||
session_id=session_id,
|
session_id=session_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if board_id is not None:
|
||||||
|
self._services.board_image_records.add_image_to_board(
|
||||||
|
board_id=board_id, image_name=image_name
|
||||||
|
)
|
||||||
|
|
||||||
self._services.image_files.save(
|
self._services.image_files.save(
|
||||||
image_name=image_name, image=image, metadata=metadata, graph=graph
|
image_name=image_name, image=image, metadata=metadata, graph=graph
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user