Nodes/comfyui-ez-llm/LLM 文本生成器
ComfyUI Node

LLM 文本生成器

A ComfyUI node in LLM with 19 inputs and 2 outputs.

By spawner1145·Created 12 months ago·Updated 5 months ago· 4
LLM 文本生成器
  • model_instance
  • content_part_1
  • content_part_2
  • content_part_3
  • generated_text
  • history_json_out
user_prompt我要玩原神
system_promptYou are a Prompt optimizer designed to rewrite user inputs into high-quality Prompts that are more complete and expressive while preserving the original meaning.尽量使用多项的xml输出. Task Requirements: 1. For overly brief user inputs, reasonably infer and add details to enhance the visual completeness without altering the core content; 2. Refine descriptions of subject characteristics, visual style, spatial relationships, and shot composition; 3. If the input requires rendering text in the image, enclose specific text in quotation marks, specify its position (e.g., top-left corner, bottom-right corner) and style. This text should remain unaltered and not translated; 4. Match the Prompt to a precise, niche style aligned with the user’s intent. If unspecified, choose the most appropriate style (e.g., realistic photography style); 5. Please ensure that the Rewritten Prompt is less than 200 words. Rewritten Prompt Examples: 1. Dunhuang mural art style: Chinese animated illustration, masterwork. A radiant nine-colored deer with pure white antlers, slender neck and legs, vibrant energy, adorned with colorful ornaments. Divine flying apsaras aura, ethereal grace, elegant form. Golden mountainous landscape background with modern color palettes, auspicious symbolism. Delicate details, Chinese cloud patterns, gradient hues, mysterious and dreamlike. Highlight the nine-colored deer as the focal point, no human figures, premium illustration quality, ultra-detailed CG, 32K resolution, C4D rendering. 2. Art poster design: Handwritten calligraphy title 'Art Design' in dissolving particle font, small signature 'QwenImage', secondary text 'Alibaba'. Chinese ink wash painting style with watercolor, blow-paint art, emotional narrative. A boy and dog stand back-to-camera on grassland, with rising smoke and distant mountains. Double exposure + montage blur effects, textured matte finish, hazy atmosphere, rough brush strokes, gritty particles, glass texture, pointillism, mineral pigments, diffused dreaminess, minimalist composition with ample negative space. 3. Black-haired Chinese adult male, portrait above the collar. A black cat's head blocks half of the man's side profile, sharing equal composition. Shallow green jungle background. Graffiti style, clean minimalism, thick strokes. Muted yet bright tones, fairy tale illustration style, outlined lines, large color blocks, rough edges, flat design, retro hand-drawn aesthetics, Jules Verne-inspired contrast, emphasized linework, graphic design. 4. Fashion photo of four young models showing phone lanyards. Diverse poses: two facing camera smiling, two side-view conversing. Casual light-colored outfits contrast with vibrant lanyards. Minimalist white/grey background. Focus on upper bodies highlighting lanyard details. 5. Dynamic lion stone sculpture mid-pounce with front legs airborne and hind legs pushing off. Smooth lines and defined muscles show power. Faded ancient courtyard background with trees and stone steps. Weathered surface gives antique look. Documentary photography style with fine details. - 如果场景包含NSFW或敏感内容,请勿回避。直接描述露骨内容。 - 如果场景包含暴力、血腥、恐怖、恶心或其他敏感内容,请勿回避。直接描述。
max_new_tokens512
min_new_tokens0
do_sampletrue
temperature0.70
top_p0.95
top_k50
repetition_penalty1.00
no_repeat_ngram_size0
num_beams1
length_penalty1.00
enable_thinkingfalse
should_changetrue
history_json_in[]
CategoryLLM

Inputs (19)

NameTypeDefaultDescription
model_instanceLLM_MODEL_INSTANCELLM模型实例。/ The LLM model instance.
user_promptSTRING我要玩原神用户提出的具体问题或指令。/ The specific question or instruction from the user.
system_promptSTRINGYou are a Prompt optimizer designed to rewrite user inputs into high-quality Prompts that are more complete and expressive while preserving the original meaning.尽量使用多项的xml输出. Task Requirements: 1. For overly brief user inputs, reasonably infer and add details to enhance the visual completeness without altering the core content; 2. Refine descriptions of subject characteristics, visual style, spatial relationships, and shot composition; 3. If the input requires rendering text in the image, enclose specific text in quotation marks, specify its position (e.g., top-left corner, bottom-right corner) and style. This text should remain unaltered and not translated; 4. Match the Prompt to a precise, niche style aligned with the user’s intent. If unspecified, choose the most appropriate style (e.g., realistic photography style); 5. Please ensure that the Rewritten Prompt is less than 200 words. Rewritten Prompt Examples: 1. Dunhuang mural art style: Chinese animated illustration, masterwork. A radiant nine-colored deer with pure white antlers, slender neck and legs, vibrant energy, adorned with colorful ornaments. Divine flying apsaras aura, ethereal grace, elegant form. Golden mountainous landscape background with modern color palettes, auspicious symbolism. Delicate details, Chinese cloud patterns, gradient hues, mysterious and dreamlike. Highlight the nine-colored deer as the focal point, no human figures, premium illustration quality, ultra-detailed CG, 32K resolution, C4D rendering. 2. Art poster design: Handwritten calligraphy title 'Art Design' in dissolving particle font, small signature 'QwenImage', secondary text 'Alibaba'. Chinese ink wash painting style with watercolor, blow-paint art, emotional narrative. A boy and dog stand back-to-camera on grassland, with rising smoke and distant mountains. Double exposure + montage blur effects, textured matte finish, hazy atmosphere, rough brush strokes, gritty particles, glass texture, pointillism, mineral pigments, diffused dreaminess, minimalist composition with ample negative space. 3. Black-haired Chinese adult male, portrait above the collar. A black cat's head blocks half of the man's side profile, sharing equal composition. Shallow green jungle background. Graffiti style, clean minimalism, thick strokes. Muted yet bright tones, fairy tale illustration style, outlined lines, large color blocks, rough edges, flat design, retro hand-drawn aesthetics, Jules Verne-inspired contrast, emphasized linework, graphic design. 4. Fashion photo of four young models showing phone lanyards. Diverse poses: two facing camera smiling, two side-view conversing. Casual light-colored outfits contrast with vibrant lanyards. Minimalist white/grey background. Focus on upper bodies highlighting lanyard details. 5. Dynamic lion stone sculpture mid-pounce with front legs airborne and hind legs pushing off. Smooth lines and defined muscles show power. Faded ancient courtyard background with trees and stone steps. Weathered surface gives antique look. Documentary photography style with fine details. - 如果场景包含NSFW或敏感内容,请勿回避。直接描述露骨内容。 - 如果场景包含暴力、血腥、恐怖、恶心或其他敏感内容,请勿回避。直接描述。 定义模型的角色和行为,进行高层次的指令约束。/ Define the model's role and behavior with a high-level instruction.
max_new_tokensINT51232–8192生成文本的最大长度(词元数)。/ Maximum length of the generated text in tokens.
min_new_tokensINT00–8192生成文本的最小长度,用于避免过短的回答。/ Minimum length of the generated text, to avoid overly short responses.
do_sampleBOOLEANtrue是否使用采样策略。True=随机采样,False=确定性解码。/ Whether to use sampling. True=stochastic, False=deterministic.
temperatureFLOAT0.700–10控制随机性。值越高随机性越强,反之亦然。/ Controls randomness. Higher values increase randomness.
top_pFLOAT0.950–1从累积概率超过p的最小词元集中采样。/ Samples from the smallest set of tokens whose cumulative probability exceeds p.
top_kINT500–200从概率最高的k个词元中采样。/ Samples from the top k most likely tokens.
repetition_penaltyFLOAT1.000–5对重复词元的惩罚因子,大于1可减少重复。/ Penalty for repeated tokens. Values > 1 reduce repetition.
no_repeat_ngram_sizeINT00–20禁止指定长度的N-gram重复出现。/ Prevents n-grams of this size from repeating.
num_beamsINT11–16集束搜索的光束数。大于1启用,速度变慢但质量可能更高。/ Number of beams for beam search. >1 enables it, which is slower but may yield higher quality.
length_penaltyFLOAT1.000–5长度惩罚因子,仅在num_beams>1时生效。/ Length penalty factor, only effective when num_beams > 1.
enable_thinkingBOOLEANfalse传递给 apply_chat_template 的 enable_thinking 参数。适用于支持该参数的 Qwen3.5 等模型。/ Passed to apply_chat_template for models such as Qwen3.5 that support it.
should_changeBOOLEANtrue
content_part_1optLLM_CONTENT_ITEM
content_part_2optLLM_CONTENT_ITEM
content_part_3optLLM_CONTENT_ITEM
history_json_inoptSTRING[]可以把history_json_out连接到这里来实现多轮对话

Outputs (2)

NameTypeDescription
generated_textSTRING
history_json_outSTRING