mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat: Create Prompt Input Node
This commit is contained in:
parent
2d9bc79ca4
commit
8a0e1b6cfc
@ -4,7 +4,8 @@ from typing import Literal
|
|||||||
|
|
||||||
from pydantic import Field
|
from pydantic import Field
|
||||||
|
|
||||||
from .baseinvocation import BaseInvocation, BaseInvocationOutput, InvocationConfig, InvocationContext
|
from .baseinvocation import (BaseInvocation, BaseInvocationOutput,
|
||||||
|
InvocationConfig, InvocationContext)
|
||||||
from .math import FloatOutput, IntOutput
|
from .math import FloatOutput, IntOutput
|
||||||
|
|
||||||
# Pass-through parameter nodes - used by subgraphs
|
# Pass-through parameter nodes - used by subgraphs
|
||||||
@ -64,3 +65,24 @@ class ParamStringInvocation(BaseInvocation):
|
|||||||
|
|
||||||
def invoke(self, context: InvocationContext) -> StringOutput:
|
def invoke(self, context: InvocationContext) -> StringOutput:
|
||||||
return StringOutput(text=self.text)
|
return StringOutput(text=self.text)
|
||||||
|
|
||||||
|
class PromptOutput(BaseInvocationOutput):
|
||||||
|
"""A string output"""
|
||||||
|
|
||||||
|
type: Literal["prompt_output"] = "prompt_output"
|
||||||
|
prompt: str = Field(default=None, description="The output prompt")
|
||||||
|
|
||||||
|
|
||||||
|
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 StringOutput(prompt=self.prompt)
|
Loading…
Reference in New Issue
Block a user