Revert "Stable Diffusion: never re-run reference image selection on swipe" This reverts commit 6d112755c32328608e0aa05943d069b69f5221e1.

94b257063855f688b68b0e40235d7a8be6f76477

permissionBRICK <40219477+permissionBRICK@users.noreply.github.com>

1 files changed, +0 -18Ignore whitespace
public/scripts/extensions/stable-diffusion/index.js+0 -18
@@ -1145,13 +1145,6 @@ const REFERENCE_IMAGE_PLACEHOLDER = /"%reference[-_]image%"/i;
11451145let pendingReferenceImage = null;
11461146
11471147/**
1148- * Whether the current generation may run an LLM reference-image selection.
1149- * Swipes reuse the prompt, so they must also reuse the reference selection
1150- * instead of asking the LLM again.
1151- */
1152-let referenceSelectionAllowed = true;
1153-
1154-/**
11551148 * Returns library entries that have an uploaded image.
11561149 * @returns {{tag: string, description: string, path: string}[]} Valid reference images.
11571150 */
@@ -1421,13 +1414,6 @@ async function resolveReferenceImageForGeneration(prompt) {
14211414 pendingReferenceImage = images[0];
14221415 return pendingReferenceImage;
14231416 }
1424- if (!referenceSelectionAllowed) {
1425- // Swipe without a stored selection (e.g. after a page reload): don't ask
1426- // the LLM again, just fall back to the first library image.
1427- console.log('SD: swipe regeneration - reusing the reference image without a new LLM selection');
1428- pendingReferenceImage = images[0];
1429- return pendingReferenceImage;
1430- }
14311417 try {
14321418 pendingReferenceImage = await selectReferenceImageWithLlm(prompt, images) ?? images[0];
14331419 } catch (error) {
@@ -4255,10 +4241,6 @@ async function sendGenerationRequest(generationType, prompt, additionalNegativeP
42554241 const isCharChat = this_chid !== undefined && !selected_group;
42564242 const ignoreNoCharForSwipe = initiator === initiators.swipe && isCharChat;
42574243
4258- // Swipes reuse the existing prompt, so the reference-image selection must be
4259- // reused as well - never re-run the LLM selection for a swipe.
4260- referenceSelectionAllowed = initiator !== initiators.swipe;
4261-
42624244 const skipCharPrefix = !ignoreNoCharForSwipe && noCharPrefix.includes(generationType);
42634245
42644246 /**