feat(nodes, ui): change how "intermediate" artefacts are handled #3463
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
feat(nodes, ui): change how "intermediate" artefacts are handled
Requirements for Handling Intermediates
intermediatesrefers to node outputs that do not need to be saved after the nodes/session that used them are complete.Currently,
intermediatesare anImageType. This doesn't make sense - bothresultsanduploadscan also beintermediates. For example, the canvas' init and mask images areuploaded intermediates, and most of the images output during the overall canvas process areresult intermediates.To handle
intermediatesproperly:intermediateAdditionally, we need to be able to exclude
intermediateimages from the gallery.Changes in this PR
The concept
intermediatenow refers a node and its outputsImageTypeis now restricted toresultsanduploads.Add a reservedAdd a reservedmetafield to nodes to hold theis_intermediateboolean. We can extend it in the future to support other nodemeta.is_intermediatefield to nodes instead, per @Kyle0654 's suggestion.is_intermediatecolumn to theimagestable to hold this. (Whenlatents,conditioningetc are added to the DB, they will also have this column.)*not* intermediate. Nodes must explicitly be markedintermediatefor their outputs to beintermediate.node.meta.is_intermediate=Trueand it will be handled as an intermediate.Handle marking uploads as
intermediateSession IDs are only generated when a session is created. We cannot create a session with an explicit id.
So we cannot associate an uploaded image with a session until the session has been created.
But to use an image in a graph (eg an init image on canvas), we need to know its name, which is only created when it is uploaded.
This creates a catch-22 for the canvas and likely many future features.
There are a few options, each of which I implemented and tested:
GraphInvocationto the sessionI think 4 is is the best, and lays groundwork for future capability to update image records.
So, this PR also includes these changes:
update()method to theImageService, and a route to call it. Updates have a strict model, currently onlysession_idandimage_categorymay be updated.update()method to theImageRecordStorageServiceto update the image record using the model.intermediate.Other changes
sessionReadyToInvoke. ThesessionInvokedaction is only ever run in response to this event. This lets us do whatever complicated setup (eg canvas) and explicitly invoking. Previously, invoking was tied to the socket subscribe events.