ComfyUI Extension: ComfyUI-AnimaPromptWeaver

Authored by naukri7707

Created

Updated

0 stars

Run ComfyUI workflows without the setup

No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.

Custom node set for ComfyUI to assist in constructing prompts for Anima text-to-image generation with structured assembly, Danbooru tag validation, and tag normalization. (Description by CC)

Looking for a different extension?

Custom Nodes (2)

README

Anima Prompt Weaver

banner

Anima Prompt Weaver 是專為 ComfyUI 打造的自訂節點套件,用於輔助 Anima 文生圖的提示詞建構。本工具基於簡單的字串比較與取代,並提供:

  • 結構化的提示詞組裝
  • Danbooru 標籤驗證功能
  • 標籤名稱正規化

節點一覽

Prompt Weaver

Anima 提示詞建構器,依照固定欄位順序組合提示詞,並對標籤進行驗證與正規化。

輸出格式

{quality_tags}, {safety}, {character_count}, {image_composition}, {character}, {series}, {artist}, {general_tags}.

{description}

輸入欄位

| 欄位 | 類型 | 說明 | |------|------|------| | quality_tags | STRING | 品質標籤,例如 masterpiece, best quality, score_9 | | safety | 下拉選單 | 內容分級:safe / sensitive / nsfw / explicit | | character_count | STRING | 角色數量,例如 1girl2girls | | image_composition | STRING | 構圖描述,例如 solo focusportrait | | character | STRING | 角色名稱 | | series | STRING | 作品系列名稱 | | artist | STRING | 畫師名稱(自動加上 @ 前綴,包含 : 者額外加括號) | | general_tags | STRING | 其餘通用標籤 | | description | STRING | 自然語言描述 | | regular_tags | BOOLEAN | 開啟後將所有標籤的 _ 替換為空格 | | verify_group | STRING | 指定要驗證的欄位,逗號分隔,例如 character_count, image_composition, general_tags |

[!Warning] 只有在 verify_group 中指定的標籤群組,且出現不合法標籤時才會從輸出中移除;未指定的標籤群組僅會在 report 中列出不合法標籤,不會改變輸出。

輸出

| 輸出 | 說明 | |------|------| | text | 組裝完成的提示詞字串 | | report | Markdown 格式的驗證報告,包含錯置標籤與不合法標籤清單 |

標籤驗證機制

  • 依照 tags/ 資料夾中的 CSV 資料庫進行比對
  • Rejected Tags(不合法標籤):不存在於對應資料庫的標籤,僅列於報告;是否從輸出中移除應由 verify_group 控制
  • Misplaced Tags(錯置標籤):放在錯誤欄位的標籤(如將構圖標籤填入角色數量欄),僅報告,不影響輸出
  • 驗證時自動將 _ 轉為空格並統一小寫
模糊比對

驗證採子字串模糊比對,只要輸入標籤中有任何連續片語存在於資料庫,即視為合法。例如輸入 white glove,因為 glove 在資料庫中,所以通過驗證。比對前會自動將 _ 換成空格並轉為小寫。

Rejected Tags(不合法標籤):標籤的所有子字串均不在對應資料庫中。列於 report;若該欄位在 verify_group 中指定,則同時從輸出中移除,否則標記為 (Ignore) 並保留輸出。

Misplaced Tags(錯置標籤):標籤通過了其他欄位的資料庫驗證,表示可能填錯欄位。僅列於 report 並標示建議欄位,不影響輸出。


Scaled Latent

解析度縮放器,直接輸出空白的 Latent 張量,省去手動換算的步驟。

輸入欄位

| 欄位 | 類型 | 說明 | |------|------|------| | size | 下拉選單 | 縮放比例:Full(100%)/ Half(50%)/ Quarter(25%)| | width | INT | 基礎寬度(64–8192,步進 8) | | height | INT | 基礎高度(64–8192,步進 8) | | batch_size | INT | 批次數量(1–64) |

輸出

| 輸出 | 說明 | |------|------| | latent | 對應解析度的空白 Latent,可直接接至 KSampler |

縮放後的尺寸會自動對齊 8 的倍數(VAE 解碼需求)。


安裝

  1. 將本資料夾複製至 ComfyUI 的 custom_nodes/ 目錄:

    cd path/to/ComfyUI/custom_nodes
    git clone https://github.com/naukri7707/ComfyUI-AnimaPromptWeaver.git anima_prompt_weaver
    
  2. 重新啟動 ComfyUI,節點將出現在 AnimaPromptWeaver 分類下。


標籤資料庫

標籤資料存放於 tags/ 資料夾:

| 檔案 | 說明 | |------|------| | character_count.csv | 角色數量相關標籤 | | image_composition.csv | 構圖相關標籤 | | general.csv | 通用標籤 |

可以自行修改後重啟 ComfyUI 來增加額外標籤。


範例工作流程

sample-workflow.json 為可直接匯入 ComfyUI 的範例工作流程。

Run ComfyUI workflows without the setup

No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.

Learn more