-
Notifications
You must be signed in to change notification settings - Fork 365
Show refined/edited/restyled images in candidates panel #2174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,11 @@ type VariantSlotInput = VariantScopeInput & { | |
| previewUrl?: string; | ||
| thumbnailUrl?: string; | ||
| error?: string; | ||
| // When true, add this candidate to the existing live tray for this scope | ||
| // instead of starting a fresh candidate set. Refine/edit/restyle set this so | ||
| // iterative results accumulate alongside the prior candidates (newest-first) | ||
| // rather than replacing them. | ||
| appendVariant?: boolean; | ||
| }; | ||
|
|
||
| let variantStateLock: Promise<void> = Promise.resolve(); | ||
|
|
@@ -96,8 +101,12 @@ export async function upsertVariantSlot(input: VariantSlotInput) { | |
| await withVariantStateLock(async () => { | ||
| const scopeId = variantScopeIdFor(input); | ||
| const previous = await readVariantStateUnlocked(scopeId); | ||
| const appendToPrevious = | ||
| previous != null && | ||
| input.appendVariant === true && | ||
| previous.libraryId === input.libraryId; | ||
| const state = | ||
| previous && isSameVariantScope(previous, input) | ||
| previous && (isSameVariantScope(previous, input) || appendToPrevious) | ||
|
Comment on lines
+104
to
+109
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Appending a refinement overwrites the tray promptWhen this branch reuses the existing tray state for Additional Info |
||
| ? previous | ||
| : { | ||
| runId: input.runId, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Appending a refinement lets in-flight batch completions reset the tray
appendToPreviousretains the prior batch's slots, but the unconditional assignments above replace that retained state'srunId/batchIdwith the refinement's run, whose batch ID is null. If a user refines an already-ready candidate while siblings from the originalgenerate-image-batchare still pending, a sibling's later ready/failed upsert hasappendVariant: falseand its original batch ID; it no longer matches the state and takes the reset branch, dropping the refinement and other candidates. Preserve the original batch identity for append-only writes or merge late in-flight sibling updates by their original slot/run identity.Additional Info