mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix metadata references, add support for negative_conditioning syntax
This commit is contained in:
committed by
psychedelicious
parent
3829ffbe66
commit
1e94d7739a
@ -21,8 +21,8 @@ export const useParameters = () => {
|
||||
* Sets prompt with toast
|
||||
*/
|
||||
const recallPrompt = useCallback(
|
||||
(prompt: unknown) => {
|
||||
if (!isString(prompt)) {
|
||||
(prompt: unknown, negativePrompt?: unknown) => {
|
||||
if (!isString(prompt) || !isString(negativePrompt)) {
|
||||
toaster({
|
||||
title: t('toast.promptNotSet'),
|
||||
description: t('toast.promptNotSetDesc'),
|
||||
@ -33,7 +33,7 @@ export const useParameters = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
setBothPrompts(prompt);
|
||||
setBothPrompts(prompt, negativePrompt);
|
||||
toaster({
|
||||
title: t('toast.promptSet'),
|
||||
status: 'info',
|
||||
@ -112,12 +112,13 @@ export const useParameters = () => {
|
||||
const recallAllParameters = useCallback(
|
||||
(image: ImageDTO | undefined) => {
|
||||
const type = image?.metadata?.type;
|
||||
if (['txt2img', 'img2img', 'inpaint'].includes(String(type))) {
|
||||
// not sure what this list should be
|
||||
if (['t2l', 'l2l', 'inpaint'].includes(String(type))) {
|
||||
dispatch(allParametersSet(image));
|
||||
|
||||
if (image?.metadata?.type === 'img2img') {
|
||||
if (image?.metadata?.type === 'l2l') {
|
||||
dispatch(setActiveTab('img2img'));
|
||||
} else if (image?.metadata?.type === 'txt2img') {
|
||||
} else if (image?.metadata?.type === 't2l') {
|
||||
dispatch(setActiveTab('txt2img'));
|
||||
}
|
||||
|
||||
|
@ -12,16 +12,11 @@ const useSetBothPrompts = () => {
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
return useCallback(
|
||||
(inputPrompt: InvokeAI.Prompt) => {
|
||||
const promptString =
|
||||
typeof inputPrompt === 'string'
|
||||
? inputPrompt
|
||||
: promptToString(inputPrompt);
|
||||
|
||||
const [prompt, negativePrompt] = getPromptAndNegative(promptString);
|
||||
|
||||
dispatch(setPositivePrompt(prompt));
|
||||
dispatch(setNegativePrompt(negativePrompt));
|
||||
(inputPrompt: InvokeAI.Prompt, negativePrompt?: InvokeAI.Prompt) => {
|
||||
dispatch(setPositivePrompt(inputPrompt));
|
||||
if (negativePrompt) {
|
||||
dispatch(setNegativePrompt(negativePrompt));
|
||||
}
|
||||
},
|
||||
[dispatch]
|
||||
);
|
||||
|
Reference in New Issue
Block a user