feat(ui): dynamic prompts loading ux

- Prompt must have an open curly brace followed by a close curly brace to enable dynamic prompts processing
- If a the given prompt already had a dynamic prompt cached, do not re-process
- If processing is not needed, user may invoke immediately
- Invoke button shows loading state when dynamic prompts are processing, tooltip says generating
- Dynamic prompts preview icon in prompt box shows loading state when processing, tooltip says generating
This commit is contained in:
psychedelicious
2024-01-02 20:43:25 +11:00
committed by Kent Keirsey
parent 0b4eb888c5
commit 870cc5b733
9 changed files with 85 additions and 36 deletions

View File

@ -3,6 +3,7 @@ import { stateSelector } from 'app/store/store';
import { useAppSelector } from 'app/store/storeHooks';
import { selectControlAdapterAll } from 'features/controlAdapters/store/controlAdaptersSlice';
import { isControlNetOrT2IAdapter } from 'features/controlAdapters/store/types';
import { getShouldProcessPrompt } from 'features/dynamicPrompts/util/getShouldProcessPrompt';
import { isInvocationNode } from 'features/nodes/types/invocation';
import { activeTabNameSelector } from 'features/ui/store/uiSelectors';
import i18n from 'i18next';
@ -22,7 +23,7 @@ const selector = createMemoizedSelector(
},
activeTabName
) => {
const { initialImage, model } = generation;
const { initialImage, model, positivePrompt } = generation;
const { isConnected } = system;
@ -87,7 +88,7 @@ const selector = createMemoizedSelector(
});
}
} else {
if (dynamicPrompts.prompts.length === 0) {
if (dynamicPrompts.prompts.length === 0 && getShouldProcessPrompt(positivePrompt)) {
reasons.push(i18n.t('parameters.invoke.noPrompts'));
}