Files
2024-06-29 18:50:22 +08:00

87 lines
2.9 KiB
Markdown

---
tags:
- Prompt
- PromptComposer
---
# One Button SuperPrompt
## Documentation
- Class name: `OneButtonSuperPrompt`
- Category: `OneButtonPrompt`
- Output node: `False`
The OneButtonSuperPrompt node is designed to generate enhanced prompts by integrating various styles and adjustments based on user-defined parameters such as insanity level and style preference. It aims to produce more creative and tailored prompts for specific needs, leveraging a combination of input parameters to influence the generation process.
## Input types
### Required
- **`prompt`**
- The main text input from which the super prompt will be generated. It serves as the base content that will be enhanced according to the specified style and insanity level.
- Comfy dtype: `STRING`
- Python dtype: `str`
- **`insanitylevel`**
- Determines the degree of creativity or deviation from the original prompt, with higher values indicating more radical transformations.
- Comfy dtype: `INT`
- Python dtype: `int`
- **`superpromptstyle`**
- Specifies the style or approach to be used in enhancing the prompt, allowing for customization of the output based on predefined styles.
- Comfy dtype: `COMBO[STRING]`
- Python dtype: `superprompterstyleslist`
### Optional
- **`seed`**
- An optional parameter that sets the random seed for generating the prompt, ensuring reproducibility of results.
- Comfy dtype: `INT`
- Python dtype: `int`
## Output types
- **`super_prompt`**
- Comfy dtype: `STRING`
- The enhanced prompt generated by the node, reflecting the applied styles and adjustments.
- Python dtype: `str`
## Usage tips
- Infra type: `CPU`
- Common nodes: unknown
## Source code
```python
class OneButtonSuperPrompt:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"prompt": ("STRING", {"default": '', "multiline": True}),
"insanitylevel": ("INT", {
"default": 5,
"min": 1, #Minimum value
"max": 10, #Maximum value
"step": 1 #Slider's step
}),
"superpromptstyle": (superprompterstyleslist, {"default": "all"}),
},
"optional": {
"seed": ("INT", {"default": 0, "min": 0, "max": 0xFFFFFFFFFFFFFFFF}),
},
}
RETURN_TYPES = ("STRING",)
RETURN_NAMES = ("super_prompt",)
FUNCTION = "Comfy_OBP_SuperPrompt"
#OUTPUT_NODE = False
CATEGORY = "OneButtonPrompt"
def Comfy_OBP_SuperPrompt(self, insanitylevel, prompt, superpromptstyle, seed):
OBPsuperprompt = one_button_superprompt(insanitylevel=insanitylevel, prompt=prompt, seed=seed, superpromptstyle=superpromptstyle)
print("Super prompt: " + OBPsuperprompt)
return (OBPsuperprompt,)
```