Moved PromptTemplate back to image.py.
This commit is contained in:
@@ -315,6 +315,31 @@ class PreviewImageTest(SaveImage):
|
||||
|
||||
|
||||
|
||||
class PromptTemplate:
|
||||
"""replaces the text in the given text string with a given other text at some key positions"""
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required":
|
||||
{
|
||||
"text": ("STRING", {"multiline": True}),
|
||||
"replacement": ("STRING", {"multiline": True}),
|
||||
"key1": ("STRING", {"multiline": False}),
|
||||
}
|
||||
}
|
||||
|
||||
CATEGORY = "text"
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "prompt_template_handler"
|
||||
|
||||
def prompt_template_handler(self, text: str, replacement, key1):
|
||||
"""
|
||||
>>> PromptTemplate().prompt_template_handler("hello world", "universe", "world")
|
||||
'hello universe'
|
||||
"""
|
||||
return (text.replace(key1, replacement),)
|
||||
|
||||
|
||||
class LoadImage:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
|
||||
Reference in New Issue
Block a user