diff --git a/invokeai/app/invocations/params.py b/invokeai/app/invocations/params.py index 127eefa21d..1a03baa7cc 100644 --- a/invokeai/app/invocations/params.py +++ b/invokeai/app/invocations/params.py @@ -4,7 +4,10 @@ from typing import Literal from pydantic import Field -from .baseinvocation import BaseInvocation, BaseInvocationOutput, InvocationConfig, InvocationContext +from invokeai.app.invocations.prompt import PromptOutput + +from .baseinvocation import (BaseInvocation, BaseInvocationOutput, + InvocationConfig, InvocationContext) from .math import FloatOutput, IntOutput # Pass-through parameter nodes - used by subgraphs @@ -64,3 +67,17 @@ class ParamStringInvocation(BaseInvocation): def invoke(self, context: InvocationContext) -> StringOutput: return StringOutput(text=self.text) + +class ParamPromptInvocation(BaseInvocation): + """A prompt input parameter""" + + type: Literal["param_prompt"] = "param_prompt" + prompt: str = Field(default="", description="The prompt value") + + class Config(InvocationConfig): + schema_extra = { + "ui": {"tags": ["param", "prompt"], "title": "Prompt"}, + } + + def invoke(self, context: InvocationContext) -> PromptOutput: + return PromptOutput(prompt=self.prompt) \ No newline at end of file diff --git a/invokeai/frontend/web/src/features/nodes/components/fields/StringInputFieldComponent.tsx b/invokeai/frontend/web/src/features/nodes/components/fields/StringInputFieldComponent.tsx index 58a201062b..18cf7e997f 100644 --- a/invokeai/frontend/web/src/features/nodes/components/fields/StringInputFieldComponent.tsx +++ b/invokeai/frontend/web/src/features/nodes/components/fields/StringInputFieldComponent.tsx @@ -1,4 +1,4 @@ -import { Input } from '@chakra-ui/react'; +import { Input, Textarea } from '@chakra-ui/react'; import { useAppDispatch } from 'app/store/storeHooks'; import { fieldValueChanged } from 'features/nodes/store/nodesSlice'; import { @@ -12,10 +12,11 @@ const StringInputFieldComponent = ( props: FieldComponentProps ) => { const { nodeId, field } = props; - const dispatch = useAppDispatch(); - const handleValueChanged = (e: ChangeEvent) => { + const handleValueChanged = ( + e: ChangeEvent + ) => { dispatch( fieldValueChanged({ nodeId, @@ -25,7 +26,11 @@ const StringInputFieldComponent = ( ); }; - return ; + return ['prompt', 'style'].includes(field.name.toLowerCase()) ? ( +