mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-21 21:22:11 -03:00
Rename all node classes to use consistent 'LM' suffix pattern: - LoraCyclerNode → LoraCyclerLM - LoraManagerLoader → LoraLoaderLM - LoraManagerTextLoader → LoraTextLoaderLM - LoraStacker → LoraStackerLM - LoraRandomizerNode → LoraRandomizerLM - LoraPoolNode → LoraPoolLM - WanVideoLoraSelectFromText → WanVideoLoraTextSelectLM - DebugMetadata → DebugMetadataLM - TriggerWordToggle → TriggerWordToggleLM - PromptLoraManager → PromptLM Updated: - Core node class definitions (9 files) - NODE_CLASS_MAPPINGS in __init__.py - Node type mappings in node_extractors.py - All related test imports and references - Logger prefixes for consistency Frontend extension names remain unchanged (LoraManager.LoraStacker, etc.)
57 lines
1.9 KiB
Python
57 lines
1.9 KiB
Python
from typing import Any, Optional
|
|
|
|
class PromptLM:
|
|
"""Encodes text (and optional trigger words) into CLIP conditioning."""
|
|
|
|
NAME = "Prompt (LoraManager)"
|
|
CATEGORY = "Lora Manager/conditioning"
|
|
DESCRIPTION = (
|
|
"Encodes a text prompt using a CLIP model into an embedding that can be used "
|
|
"to guide the diffusion model towards generating specific images."
|
|
)
|
|
|
|
@classmethod
|
|
def INPUT_TYPES(cls):
|
|
return {
|
|
"required": {
|
|
"text": (
|
|
"AUTOCOMPLETE_TEXT_EMBEDDINGS",
|
|
{
|
|
"placeholder": "Enter prompt...",
|
|
"tooltip": "The text to be encoded.",
|
|
},
|
|
),
|
|
"clip": (
|
|
'CLIP',
|
|
{"tooltip": "The CLIP model used for encoding the text."},
|
|
),
|
|
},
|
|
"optional": {
|
|
"trigger_words": (
|
|
'STRING',
|
|
{
|
|
"forceInput": True,
|
|
"tooltip": (
|
|
"Optional trigger words to prepend to the text before "
|
|
"encoding."
|
|
)
|
|
},
|
|
)
|
|
},
|
|
}
|
|
|
|
RETURN_TYPES = ('CONDITIONING', 'STRING',)
|
|
RETURN_NAMES = ('CONDITIONING', 'PROMPT',)
|
|
OUTPUT_TOOLTIPS = (
|
|
"A conditioning containing the embedded text used to guide the diffusion model.",
|
|
)
|
|
FUNCTION = "encode"
|
|
|
|
def encode(self, text: str, clip: Any, trigger_words: Optional[str] = None):
|
|
prompt = text
|
|
if trigger_words:
|
|
prompt = ", ".join([trigger_words, text])
|
|
|
|
from nodes import CLIPTextEncode # type: ignore
|
|
conditioning = CLIPTextEncode().encode(clip, prompt)[0]
|
|
return (conditioning, prompt,) |