Extensions/comfyui-vivid-prompt-analysis-replacement
ComfyUI Extension

comfyui-vivid-prompt-analysis-replacement

ComfyUI custom node for structured prompt analysis and replacement

By cction·Created 3 months ago·Updated 3 months ago· 1
cction/ComfyUI-Vivid-Prompt-Analysis-Replacement
Nodes1
On cloudLocal install
CategoryPromptTools
Stars1
Updated3 months ago
Readme

ComfyUI Vivid Prompt Analysis Replacement

A lightweight ComfyUI custom node package that exposes the PromptReplaceParserNode node for structured Chinese prompt parsing and override merging.

What It Does

This node accepts:

  • source_text: base prompt text in one of these formats:
    • JSON string
    • Python dict-like string
    • labeled text using 目标/保留/迁移/环境/光影/细节/输出/类型选择
  • override_text: partial override text using the same labeled format

It outputs:

  • prompt_list
  • prompt_text
  • style_text

Node Behavior

The node preserves the current behavior from the original implementation:

  • Parses source_text using json.loads, ast.literal_eval, then labeled text fallback
  • Parses override_text from dict input or labeled text
  • Uses override values only when they contain meaningful Chinese content
  • Appends sentence punctuation when needed
  • Removes whitespace from each final output line
  • Returns merged prompt lines, joined prompt text, and style text

Installation

Clone this repository into your ComfyUI/custom_nodes directory:

cd <ComfyUI root>\custom_nodes
git clone https://github.com/<your-name>/ComfyUI-Vivid-Prompt-Analysis-Replacement.git

Then restart ComfyUI.

Example Inputs

source_text

{"转换描述": {"目标": "构建现代建筑方案", "环境": "建筑前方是城市广场"}, "类型选择": "精细模型"}

override_text

环境:建筑前方是滨水平台,周边有树木与行人。
光影:黄昏侧光,玻璃低反射。

Node Info

  • Class type: PromptReplaceParserNode
  • Display name: Prompt Replace Parser
  • Category: PromptTools

Development

Run tests locally:

cd ComfyUI-Vivid-Prompt-Analysis-Replacement
python -m pytest

License

MIT