Skip to content

Commit 179b988

Browse files
fix(ui): prompt concat derived state recall
1 parent d913a3c commit 179b988

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

invokeai/frontend/web/src/features/metadata/parsing.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -950,21 +950,24 @@ const recallByHandlers = async (arg: {
950950
}
951951
}
952952

953-
// If we recalled style prompts, and they were _different_ from the positive prompt, we need to disable prompt concat.
953+
// We may need to update the prompt concat flag based on the recalled prompts
954954
const positivePrompt = recalled.get(MetadataHandlers.PositivePrompt);
955955
const negativePrompt = recalled.get(MetadataHandlers.NegativePrompt);
956956
const positiveStylePrompt = recalled.get(MetadataHandlers.PositiveStylePrompt);
957957
const negativeStylePrompt = recalled.get(MetadataHandlers.NegativeStylePrompt);
958958

959+
// The values will be undefined if the handler was not recalled
959960
if (
960-
(positiveStylePrompt && positiveStylePrompt !== positivePrompt) ||
961-
(negativeStylePrompt && negativeStylePrompt !== negativePrompt)
961+
positivePrompt !== undefined ||
962+
negativePrompt !== undefined ||
963+
positiveStylePrompt !== undefined ||
964+
negativeStylePrompt !== undefined
962965
) {
963-
// If we set the negative style prompt or positive style prompt, we should disable prompt concat
964-
store.dispatch(shouldConcatPromptsChanged(false));
965-
} else {
966-
// Otherwise, we should enable prompt concat
967-
store.dispatch(shouldConcatPromptsChanged(true));
966+
const concat =
967+
(Boolean(positiveStylePrompt) && positiveStylePrompt === positivePrompt) ||
968+
(Boolean(negativeStylePrompt) && negativeStylePrompt === negativePrompt);
969+
970+
store.dispatch(shouldConcatPromptsChanged(concat));
968971
}
969972

970973
if (!silent) {

0 commit comments

Comments
 (0)