Save 4 hours! We auto-setup your workflow! Free!

Drop your workflow.json — we handle every dependency, custom node, and model. Just open the link and run.

Auto-Setup Workflow Json (Free) Now!
ComfyUI > Nodes > ComfyUI-llama_Dapao > 🧳Qwen-image2.1提示词优化@炮老师的小课堂

ComfyUI Node: 🧳Qwen-image2.1提示词优化@炮老师的小课堂

Class Name

DapaoQwenImage21Prompt

Category
🍭大炮-llama-cpp
Author
paolaoshi (Account age: 0days)
Extension
ComfyUI-llama_Dapao
Latest Updated
2026-11-14
Github Stars
0.07K

How to Install ComfyUI-llama_Dapao

Install this extension via the ComfyUI Manager by searching for ComfyUI-llama_Dapao
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-llama_Dapao in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

🧳Qwen-image2.1提示词优化@炮老师的小课堂 Description

Rewrites creation and editing requests into Qwen-Image-2.1 prompts with separate canvas ratios.

🧳Qwen-image2.1提示词优化@炮老师的小课堂:

DapaoQwenImage21Prompt turns an image-making request into a more structured prompt for Qwen-Image-2.1 workflows. It uses a local model loaded through the project’s llama.cpp model loader and supplies that model with reference rules for text-to-image generation or image editing. Depending on the task, it can help describe a new scene, guide changes to an existing image, or clarify the roles of several reference images. It also separates the prompt from canvas-ratio information, making the result easier to connect to later workflow steps. The quality and accuracy of the rewrite depend on the local model and, when images are involved, its ability to interpret them; this node prepares a prompt but does not generate the final image.

🧳Qwen-image2.1提示词优化@炮老师的小课堂 Input Parameters:

🤖本地模型

Connect a compatible DAPAO_LOCAL_MODEL from the project’s local model loader. This model interprets your request and writes the revised prompt, so its instruction-following ability affects the result. When you connect reference images, the model must also have a working visual processor and a matching mmproj selected in the loader. This input is required and has no default.

📝原始需求

Enter what you want to create or change. Describe the subject, setting, style, details to preserve, and any important restrictions in ordinary language. This text is combined with 🔗上游需求 when that optional input is connected; at least one of the two must contain text. The default is an empty string, and the field supports multiple lines.

🧭任务模式

Choose how the request should be interpreted. The options are 自动识别 (default), 文生图, 图像编辑与局部修改, 多图合成, 风格迁移, 背景替换, 换脸或换装, 扩图, and 参考主体生成新场景. 自动识别 uses text-to-image rules when no reference image is connected and editing rules when at least one is connected. 文生图 requires no reference images; every other listed task mode uses editing rules and requires at least one. The chosen task label is also passed to the local model as guidance, but the source does not establish separate processing logic for each editing subtype.

📐输出画幅

Choose whether the canvas ratio should be inferred, inherited, or specified. The options are 自动判断 (default), 继承基准图, 3:2, 2:3, 1:1, 16:9, 9:16, 1:2, 3:4, 2:1, 21:9, 4:3, 9:21, 4:5, 3:1, 5:4, 1:3, 18:39, 9:20, 7:3, 9:5, 5:7, and 7:5. A specific ratio is returned as 📐wh_ratio; inheriting an editing canvas is returned through 🖼️ratio_follow. In automatic mode, the local model can provide a ratio or a reference-image tag, subject to the node’s validation and fallback rules. 继承基准图 is invalid for text-to-image work. Ratio information is kept out of the usable prompt.

🖼️基准图

Select which connected reference image serves as the base canvas for editing. The options are 1 through 8, with 1 as the default. Image numbers follow the order of connected reference images, not necessarily the numbers in their socket names: if only 🖼️参考图2 is connected, it is the first image for this setting. The selection is included in the instructions sent to the model and determines which image 继承基准图 follows. You cannot select a number greater than the number of connected images.

🔤画面文字

Set the instruction given to the model about readable text in the resulting image. The options are 按用户原文与参考图判断 (default), 禁止新增可读文字, 严格保留用户指定文字, and 自定义准确文字. Use the default to let the model consider your request and references, the prohibition when you do not want new readable text, or a preservation option when exact wording matters. These are prompt-writing instructions, not a guarantee that a later image generator will render text perfectly. Selecting 自定义准确文字 requires a nonempty value in ✍️自定义准确文字.

✍️自定义准确文字

Enter the exact text you want the rewritten prompt to request when 🔤画面文字 is set to 自定义准确文字. The node asks the model to preserve those characters exactly; the interface tooltip specifies straight double quotation marks for the text. This multiline field defaults to an empty string and is only applied under that policy. Leaving it empty while that policy is selected causes an error.

🧩输出样式

Choose the presentation of 🧩展示结果. The options are 标准展示(解析+提示词+建议) (default), 仅提示词, and 严格JSON. Standard display includes a short optimization explanation, canvas choice, usable prompt, and suggestions; the other options display only the prompt or the normalized JSON result. This setting does not change 📋可用提示词, which remains the plain rewritten prompt.

📤最大输出token

Set the maximum number of tokens allowed for the local model’s reply. The default is 2048; the minimum is 256, the maximum is 8192, and the control changes in steps of 128. A higher limit gives the model more room to complete its requested JSON, especially for complex multi-image instructions, but may increase processing time. If the response is cut off before it contains a usable JSON object or prompt, increasing this limit may help.

🌡️温度

Control variation in the local model’s response. The default is 0.35; the minimum is 0.0, the maximum is 2.0, and the control changes in steps of 0.01. Lower values generally favor more consistent instruction-following, which can be useful when image roles or exact wording are important. Higher values allow more variation but may make the requested structure harder for the model to follow.

🎲随机种子

Provide the seed sent to the local model for its reply. The default and minimum are 0, and the maximum is 18446744073709551615. Keeping a seed fixed can help when comparing prompt-writing settings, although identical results are not guaranteed by this source. The control also supports ComfyUI’s after-generation seed behavior.

🧹为生图释放显存

Choose whether to release the local language model after prompt generation to make its memory available for later image-generation steps. The default is true. When enabled, the model must be loaded again on a subsequent run; when disabled, the node may still release it if the loader indicates unloading is necessary. Release is attempted when the run ends, including after an error.

🖼️参考图1

Optionally connect an IMAGE for an editing task. Each connected reference must contain exactly one RGB or RGBA image, not a batch. Connected images are passed to the visual model and assigned sequential tags such as <image1>. This socket has no default; omit it for text-to-image generation.

🖼️参考图2

Optionally connect a second IMAGE. As with every reference socket, it must contain one RGB or RGBA image. Its sequential tag depends on which earlier reference sockets are actually connected, so it is not necessarily <image2>. Use it when a second source has a meaningful role in an editing or composition request; it has no default.

🖼️参考图3

Optionally connect another single RGB or RGBA IMAGE for an image-based request. The node passes connected references in socket-number order and asks the model to explain each image’s role when several are present. This socket has no default.

🖼️参考图4

Optionally connect another single RGB or RGBA IMAGE to provide further visual material for editing or composition. It is included after any connected lower-numbered sockets and receives the next sequential image tag. This socket has no default.

🖼️参考图5

Optionally connect another single RGB or RGBA IMAGE. Clearly state in your request what this reference should contribute so the model can distinguish it from other connected images. It receives a sequential tag based on connection order and has no default.

🖼️参考图6

Optionally connect another single RGB or RGBA IMAGE for an image-based task. The reference is sent to the local visual model alongside the other connected images; its socket number does not by itself determine its sequential tag. This socket has no default.

🖼️参考图7

Optionally connect another single RGB or RGBA IMAGE. Use a separate connection for each reference rather than supplying an image batch, and describe its intended role when several images are present. This socket has no default.

🖼️参考图8

Optionally connect an eighth single RGB or RGBA IMAGE, the highest-numbered reference socket available. Connected references are ordered by socket number, then numbered sequentially for the model and prompt. This socket has no default.

🔗上游需求

Optionally connect a STRING from an earlier node. Its text is placed before 📝原始需求 when both contain text, allowing you to build on an upstream brief while adding local instructions. At least one of those two inputs must be nonempty. This is a connection-only input and has no default.

🧳Qwen-image2.1提示词优化@炮老师的小课堂 Output Parameters:

📋可用提示词

The rewritten prompt as a plain STRING for a downstream image-generation or editing step. The node removes line breaks and repeated whitespace from this value and requires it to be nonempty. Canvas-ratio fields, the optimization explanation, and suggestions are not included. For multi-image editing, the node checks that this prompt mentions every connected image’s sequential tag.

📐wh_ratio

A STRING containing a numeric width-to-height ratio such as 3:2, or an empty string when the result follows a reference image instead. A specifically selected ratio appears here. In text-to-image automatic mode, the node uses the model’s ratio or falls back to 3:2 if none is supplied. Interpret this as ratio metadata for a later step, not as a resolution or a change already made to an image.

🖼️ratio_follow

A STRING naming the reference image whose ratio should be followed, such as <image1>, or an empty string when 📐wh_ratio supplies a numeric ratio. Selecting 继承基准图 produces the chosen base image’s tag. In automatic editing mode, this may contain a model-selected valid tag or fall back to the base image if neither ratio field is supplied. The node checks that a returned tag refers to a connected image.

🧾JSON结果

A compact JSON STRING containing the normalized keys rewritten_prompt, wh_ratio, and ratio_follow. Use it when another step needs these three values together in a machine-readable form. It does not include the model’s optimization explanation or tweak suggestions, and its contents are the same regardless of the selected display style.

🧩展示结果

A STRING intended for reading or presentation. With the default style, it contains the optimization explanation, canvas choice, rewritten prompt, and up to three suggestions when the model supplies suggestions as a list. 仅提示词 makes it identical to the usable prompt; 严格JSON makes it identical to the JSON result. This output changes presentation only, so connect 📋可用提示词 when a later node needs just prompt text.

🧳Qwen-image2.1提示词优化@炮老师的小课堂 Usage Tips:

  • For a new image with no references, leave 🧭任务模式 at 自动识别 or choose 文生图. Write a concrete brief covering the subject, environment, composition, and details that matter; choose a specific 📐输出画幅 only when your layout requires one.
  • For editing, connect at least one reference image and use 自动识别 or an appropriate editing task label. Specify what should change and what should remain. If you want to preserve a particular image’s canvas ratio, set 🖼️基准图 to its sequential position and 📐输出画幅 to 继承基准图.
  • For multiple references, describe each image’s purpose explicitly. Connected images are numbered consecutively in socket order, even when you leave gaps between sockets. The rewritten prompt must include every resulting image tag, such as <image1> and <image2>.
  • When readable words matter, choose 严格保留用户指定文字 or 自定义准确文字 and provide the exact wording. Review the rewritten prompt before generating an image, particularly for names, signage, and other text where a single character matters.
  • Start with the default 2048 maximum output tokens and 0.35 temperature. If a complex request produces incomplete JSON, try a higher token limit; if the model repeatedly misses structural instructions, try a lower temperature or a stronger compatible local model.
  • Connect 📋可用提示词 to a node that expects prompt text and use 📐wh_ratio or 🖼️ratio_follow separately where your workflow supports them. Use 🧩展示结果 for review, and leave 🧹为生图释放显存 enabled when the subsequent image-generation stage needs the available memory.

🧳Qwen-image2.1提示词优化@炮老师的小课堂 Common Errors and Solutions:

请填写原始需求或连接上游需求。

  • Explanation: Both 📝原始需求 and 🔗上游需求 are empty after surrounding whitespace is removed.
  • Solution: Enter a request in 📝原始需求 or connect an upstream string containing a request.

改图模式至少需要连接一张参考图。

  • Explanation: The selected task uses image-editing rules, but no reference image is connected.
  • Solution: Connect at least one single image, or choose 文生图 if you intend to create an image without references.

文生图模式不接收参考图;请选择自动识别或改图模式。

  • Explanation: 🧭任务模式 is set to 文生图 while one or more references are connected.
  • Solution: Disconnect the reference images, or change the task mode to 自动识别 or an appropriate editing option.

已连接N张参考图,基准图不能选M。

  • Explanation: 🖼️基准图 selects a sequential image number beyond the number of connected references. N and M are replaced by the relevant numbers in the actual message.
  • Solution: Select a base-image number from 1 through the number of connected images, remembering that gaps between sockets do not create image positions.

文生图没有基准图,请选择自动判断或具体画幅。

  • Explanation: 📐输出画幅 is set to 继承基准图 for a text-to-image request, which has no base image.
  • Solution: Select 自动判断 or one of the listed numeric ratios.

选择自定义准确文字后,请填写文字内容。

  • Explanation: 🔤画面文字 is set to 自定义准确文字, but ✍️自定义准确文字 is empty.
  • Solution: Enter the exact text to request, or select a different text policy.

参考图N必须是单张IMAGE;请先拆分批次。

  • Explanation: A connected reference is not in the expected single-image form; an image batch with more than one image also triggers this error.
  • Solution: Split the batch and connect one image to each reference socket. N identifies the affected socket.

参考图N必须是RGB或RGBA图像。

  • Explanation: The connected reference does not have the expected three RGB or four RGBA color channels.
  • Solution: Convert it to a standard RGB or RGBA image before connecting it. N identifies the affected socket.

参考图需要视觉模型,请在本地模型加载器中选择配套mmproj。

  • Explanation: A reference image is connected, but the local model settings do not specify a visual-projector file.
  • Solution: Select a compatible mmproj for the model in the local model loader, or disconnect the images and use text-to-image mode.

视觉处理器没有成功加载,请检查主模型与mmproj是否配套。

  • Explanation: The model has no working visual chat handler, so the node cannot pass it reference images.
  • Solution: Check that the main model and mmproj are compatible and loaded successfully. For a text-only request, disconnect the references.

本地模型没有返回可解析的JSON;请提高最大输出token,或更换指令遵循能力更强的模型。

  • Explanation: The model’s reply did not contain a JSON object the node could parse. The reply may have been incomplete or may not have followed the requested format.
  • Solution: Increase 📤最大输出token and try again. If it persists, use a compatible model with stronger instruction-following ability or simplify the brief.

本地模型没有生成有效提示词。

  • Explanation: The parsed reply has no nonempty rewritten_prompt value.
  • Solution: Make the request more specific and retry. If the model repeatedly omits the prompt, try a more capable compatible model.

模型返回的画幅比例无效:…

  • Explanation: The returned ratio is not in the numeric width-to-height form the node accepts, such as 3:2. This can occur when an automatic ratio relies on a malformed model reply.
  • Solution: Select a specific ratio in 📐输出画幅 or retry with a model that follows the requested JSON fields more reliably.

模型返回的基准图标签无效:…

  • Explanation: The returned ratio_follow value is not a valid image tag or points beyond the number of connected references.
  • Solution: For editing, choose 继承基准图 and a valid 🖼️基准图, or select a specific numeric ratio instead of relying on an automatic choice.

多图提示词缺少图像引用:…

  • Explanation: With two or more connected references, the rewritten prompt does not mention every sequential image tag. The message lists the missing tags.
  • Solution: State each reference’s role clearly in the brief and retry. Check connection order, since connected sockets are renumbered consecutively for the prompt.

🧳Qwen-image2.1提示词优化@炮老师的小课堂 Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-llama_Dapao
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

🧳Qwen-image2.1提示词优化@炮老师的小课堂