2.8 KiB
2.8 KiB
Documentation
- Class name: SDXLPromptStylerbyQuantumRealism
- Category: Style Prompts
- Output node: False
- Repo Ref: https://github.com/wolfden/ComfyUi_PromptStylers
该节点旨在根据预定义的风格对提示进行样式化,增强文本的主题和审美展示,同时不改变其核心信息。
Input types
Required
- text_positive
- 正面文本输入对于生成正面框架的提示至关重要。它是应用风格化元素的基础。
- Comfy dtype: STRING
- Python dtype: str
- text_negative
- 负面文本输入对于提供与正面文本对比的元素至关重要,使节点能够创建更细致和平衡的提示。
- Comfy dtype: STRING
- Python dtype: str
- style
- 风格参数在确定风格化提示的整体审美和主题方向方面起着关键作用,指导转换过程。
- Comfy dtype: COMBO
- Python dtype: str
Optional
- log_prompt
- 日志提示选项允许对提示生成过程进行可选记录,这对于调试和理解节点的运作非常有益。
- Comfy dtype: COMBO
- Python dtype: str
Output types
- positive_prompt_text_g
- 输出提供了一个风格化增强的正面提示,反映了输入文本与所选风格的融合。
- Comfy dtype: STRING
- Python dtype: str
- negative_prompt_text_g
- 输出提供了一个风格化增强的负面提示,为正面提示提供了对照点,并有助于全面展示。
- Comfy dtype: STRING
- Python dtype: str
Usage tips
- Infra type: CPU
Source code
class SDXLPromptStylerbyQuantumRealism:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(self):
p = os.path.dirname(os.path.realpath(__file__))
file_path = os.path.join(p, 'sdxl_styles_qr.json')
self.json_data = read_json_file(file_path)
styles = read_sdxl_styles(self.json_data)
return {'required': {'text_positive': ('STRING', {'default': '', 'multiline': True}), 'text_negative': ('STRING', {'default': '', 'multiline': True}), 'style': (styles,), 'log_prompt': (['No', 'Yes'], {'default': 'No'})}}
RETURN_TYPES = ('STRING', 'STRING')
RETURN_NAMES = ('positive_prompt_text_g', 'negative_prompt_text_g')
FUNCTION = 'prompt_styler'
CATEGORY = 'Style Prompts'
def prompt_styler(self, text_positive, text_negative, style, log_prompt):
(positive_prompt, negative_prompt) = read_sdxl_templates_replace_and_combine(self.json_data, style, text_positive, text_negative)
if log_prompt == 'Yes':
print(f'style: {style}')
print(f'text_positive: {text_positive}')
print(f'text_negative: {text_negative}')
print(f'positive_prompt: {positive_prompt}')
print(f'negative_prompt: {negative_prompt}')
return (positive_prompt, negative_prompt)