Skip to content

Commit 5a60529

Browse files
maryhippMary Hipppsychedelicious
authored andcommitted
add credits to queue item status changed (invoke-ai#7993)
* display credit column in queue list if shouldShowCredits is true * add credits when queue item status changes * chore(ui): typegen --------- Co-authored-by: Mary Hipp <maryhipp@Marys-MacBook-Air.local> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com>
1 parent 2b55cb5 commit 5a60529

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

invokeai/app/services/events/events_common.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ class QueueItemStatusChangedEvent(QueueItemEventBase):
241241
batch_status: BatchStatus = Field(description="The status of the batch")
242242
queue_status: SessionQueueStatus = Field(description="The status of the queue")
243243
session_id: str = Field(description="The ID of the session (aka graph execution state)")
244+
credits: Optional[float] = Field(default=None, description="The total credits used for this queue item")
244245

245246
@classmethod
246247
def build(
@@ -263,6 +264,7 @@ def build(
263264
completed_at=str(queue_item.completed_at) if queue_item.completed_at else None,
264265
batch_status=batch_status,
265266
queue_status=queue_status,
267+
credits=queue_item.credits,
266268
)
267269

268270

invokeai/app/services/session_queue/session_queue_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ class SessionQueueItemWithoutGraph(BaseModel):
257257
api_output_fields: Optional[list[FieldIdentifier]] = Field(
258258
default=None, description="The nodes that were used as output from the API"
259259
)
260-
credits: Optional[int] = Field(default=None, description="The total credits used for this queue item")
260+
credits: Optional[float] = Field(default=None, description="The total credits used for this queue item")
261261

262262
@classmethod
263263
def queue_item_dto_from_dict(cls, queue_item_dict: dict) -> "SessionQueueItemDTO":

invokeai/frontend/web/src/services/api/schema.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17959,6 +17959,12 @@ export type components = {
1795917959
* @description The ID of the session (aka graph execution state)
1796017960
*/
1796117961
session_id: string;
17962+
/**
17963+
* Credits
17964+
* @description The total credits used for this queue item
17965+
* @default null
17966+
*/
17967+
credits: number | null;
1796217968
};
1796317969
/**
1796417970
* QueueItemsRetriedEvent

invokeai/frontend/web/src/services/events/setEventListeners.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ export const setEventListeners = ({ socket, store, setIsConnected }: SetEventLis
337337
error_message,
338338
error_traceback,
339339
destination,
340+
credits,
340341
} = data;
341342

342343
log.debug({ data }, `Queue item ${item_id} status updated: ${status}`);
@@ -354,6 +355,7 @@ export const setEventListeners = ({ socket, store, setIsConnected }: SetEventLis
354355
error_type,
355356
error_message,
356357
error_traceback,
358+
credits,
357359
},
358360
});
359361
})

0 commit comments

Comments
 (0)