Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

fix(ci): regenerate openapi.json and give socket test stubs the preview store

Lincoln Steina4d940bffafa
diff --git a/invokeai/frontend/web/openapi.json b/invokeai/frontend/web/openapi.json
index 69ef493b4b..3c91d6a743 100644
--- a/invokeai/frontend/web/openapi.json
+++ b/invokeai/frontend/web/openapi.json
@@ -11146,6 +11146,58 @@
}
}
},
+ "/api/v1/queue/{queue_id}/previews": {
+ "get": {
+ "tags": ["queue"],
+ "summary": "Get Progress Previews",
+ "description": "The latest denoising preview frame of each of the caller's running queue items: the same\npayloads as the `invocation_progress` socket events, with their revisions. A client whose socket\nwas dropped, or whose tab was hidden, reconciles from this instead of waiting for the next step.\nOwner-scoped: progress is personal UI, so even admins see only their own.",
+ "operationId": "get_progress_previews",
+ "security": [
+ {
+ "HTTPBearer": []
+ }
+ ],
+ "parameters": [
+ {
+ "name": "queue_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "description": "The queue id to perform this operation on",
+ "title": "Queue Id"
+ },
+ "description": "The queue id to perform this operation on"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Successful Response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/ProgressPreviewDTO"
+ },
+ "title": "Response 200 Get Progress Previews"
+ }
+ }
+ }
+ },
+ "422": {
+ "description": "Validation Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/HTTPValidationError"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
"/api/v1/queue/{queue_id}/next": {
"get": {
"tags": ["queue"],
@@ -51692,6 +51744,19 @@
"default": null,
"description": "The device processing this session, e.g. 'cuda:1' (set only when running on a GPU)",
"title": "Device"
+ },
+ "revision": {
+ "anyOf": [
+ {
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Monotonic per queue item and session, set on image-bearing frames. A frame at or below a revision already shown is stale: the same frame may reach a client twice (live stream and reconnect replay) and must never move the preview backwards.",
+ "title": "Revision"
}
},
"required": [
@@ -51708,7 +51773,8 @@
"message",
"percentage",
"image",
- "device"
+ "device",
+ "revision"
],
"title": "InvocationProgressEvent",
"type": "object"
@@ -79657,29 +79723,106 @@
"title": "PresetType"
},
"ProgressImage": {
- "description": "The progress image sent intermittently during processing",
"properties": {
"width": {
- "description": "The effective width of the image in pixels",
- "minimum": 1,
+ "type": "integer",
+ "minimum": 1.0,
"title": "Width",
- "type": "integer"
+ "description": "The effective width of the image in pixels"
},
"height": {
- "description": "The effective height of the image in pixels",
- "minimum": 1,
+ "type": "integer",
+ "minimum": 1.0,
"title": "Height",
- "type": "integer"
+ "description": "The effective height of the image in pixels"
},
"dataURL": {
- "description": "The image data as a b64 data URL",
+ "type": "string",
"title": "Dataurl",
- "type": "string"
+ "description": "The image data as a b64 data URL"
}
},
+ "type": "object",
"required": ["width", "height", "dataURL"],
"title": "ProgressImage",
- "type": "object"
+ "description": "The progress image sent intermittently during processing"
+ },
+ "ProgressPreviewDTO": {
+ "properties": {
+ "queue_id": {
+ "type": "string",
+ "title": "Queue Id",
+ "description": "The ID of the queue"
+ },
+ "item_id": {
+ "type": "integer",
+ "title": "Item Id",
+ "description": "The ID of the queue item"
+ },
+ "session_id": {
+ "type": "string",
+ "title": "Session Id",
+ "description": "The ID of the session (aka graph execution state)"
+ },
+ "invocation_source_id": {
+ "type": "string",
+ "title": "Invocation Source Id",
+ "description": "The ID of the prepared invocation's source node"
+ },
+ "revision": {
+ "anyOf": [
+ {
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Revision",
+ "description": "Monotonic per queue item and session; see InvocationProgressEvent"
+ },
+ "message": {
+ "type": "string",
+ "title": "Message",
+ "description": "A message to display"
+ },
+ "percentage": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Percentage",
+ "description": "The percentage of the progress, or null if indeterminate"
+ },
+ "image": {
+ "anyOf": [
+ {
+ "$ref": "#/components/schemas/ProgressImage"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "The latest denoising preview"
+ }
+ },
+ "type": "object",
+ "required": [
+ "queue_id",
+ "item_id",
+ "session_id",
+ "invocation_source_id",
+ "revision",
+ "message",
+ "percentage",
+ "image"
+ ],
+ "title": "ProgressPreviewDTO",
+ "description": "The latest preview frame of a running queue item, as served by `GET /queue/{queue_id}/previews`.\n\nThe fields of the `invocation_progress` socket event a preview consumer reads, without the\nserialized invocation. A separate model rather than the event itself: exposing the event as a\nresponse model would give it a second OpenAPI schema variant and change the generated client\ntypes for every socket consumer."
},
"ProjectBoardItemDTO": {
"properties": {
diff --git a/tests/app/test_socket_privilege_revocation.py b/tests/app/test_socket_privilege_revocation.py
index e09011b23f..b094c0b566 100644
--- a/tests/app/test_socket_privilege_revocation.py
+++ b/tests/app/test_socket_privilege_revocation.py
@@ -18,6 +18,7 @@ from fastapi import FastAPI
from invokeai.app.api.sockets import SOCKET_REVALIDATION_FAILURE_LIMIT, SocketIO
from invokeai.app.services.events.events_common import UserAccessChangedEvent
+from invokeai.app.services.progress_previews.progress_previews_default import MemoryProgressPreviews
@pytest.fixture
@@ -40,6 +41,7 @@ def _patch_multiuser_context(
invoker = SimpleNamespace(
services=SimpleNamespace(
configuration=SimpleNamespace(multiuser=True),
+ progress_previews=MemoryProgressPreviews(),
users=SimpleNamespace(get=lambda candidate_user_id: user if candidate_user_id == user_id else None),
)
)
@@ -156,6 +158,7 @@ class TestUserAccessChangedHandler:
invoker = SimpleNamespace(
services=SimpleNamespace(
configuration=SimpleNamespace(multiuser=True),
+ progress_previews=MemoryProgressPreviews(),
users=SimpleNamespace(get=lambda user_id: record),
)
)
@@ -389,6 +392,7 @@ class _SweepHarness:
invoker = SimpleNamespace(
services=SimpleNamespace(
configuration=SimpleNamespace(multiuser=multiuser),
+ progress_previews=MemoryProgressPreviews(),
users=SimpleNamespace(get=get),
events=SimpleNamespace(emit_user_access_changed=lambda **kwargs: emitted.append(kwargs)),
session_processor=SimpleNamespace(
@@ -622,6 +626,7 @@ class TestRevalidationSweep(_SweepHarness):
invoker = SimpleNamespace(
services=SimpleNamespace(
configuration=SimpleNamespace(multiuser=True),
+ progress_previews=MemoryProgressPreviews(),
users=SimpleNamespace(get=get),
events=SimpleNamespace(emit_user_access_changed=lambda **kwargs: None),
)
@@ -942,6 +947,7 @@ class TestRoomChangesAndCacheStayInStep:
invoker = SimpleNamespace(
services=SimpleNamespace(
configuration=SimpleNamespace(multiuser=True),
+ progress_previews=MemoryProgressPreviews(),
users=SimpleNamespace(get=lambda user_id: user),
)
)
@@ -973,6 +979,7 @@ class TestRoomChangesAndCacheStayInStep:
invoker = SimpleNamespace(
services=SimpleNamespace(
configuration=SimpleNamespace(multiuser=True),
+ progress_previews=MemoryProgressPreviews(),
users=SimpleNamespace(
get=lambda user_id: SimpleNamespace(user_id="user-1", is_admin=False, is_active=True, token_epoch=0)
),
@@ -1081,6 +1088,7 @@ class TestHandlerRereadsAtThePointOfDecision:
invoker = SimpleNamespace(
services=SimpleNamespace(
configuration=SimpleNamespace(multiuser=True),
+ progress_previews=MemoryProgressPreviews(),
users=SimpleNamespace(get=lambda user_id: user),
)
)
@@ -1136,6 +1144,7 @@ class TestHandlerRereadsAtThePointOfDecision:
invoker = SimpleNamespace(
services=SimpleNamespace(
configuration=SimpleNamespace(multiuser=True),
+ progress_previews=MemoryProgressPreviews(),
users=SimpleNamespace(get=explode),
)
)
@@ -1193,6 +1202,7 @@ class TestHandlerRereadsAtThePointOfDecision:
invoker = SimpleNamespace(
services=SimpleNamespace(
configuration=SimpleNamespace(multiuser=True),
+ progress_previews=MemoryProgressPreviews(),
users=SimpleNamespace(get=lambda user_id: deactivated),
events=SimpleNamespace(emit_user_access_changed=lambda **kwargs: emitted.append(kwargs)),
session_processor=SimpleNamespace(get_running_queue_item_owners=lambda: set()),