From e20b03f42d5b9e55c78d8eed8be35aef668b1b42 Mon Sep 17 00:00:00 2001 From: NineKey Date: Wed, 28 Jan 2026 19:53:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=A4=9A=E8=AA=9E=E8=A8=80?= =?UTF-8?q?=E6=94=AF=E6=8F=B4=EF=BC=8C=E5=8C=85=E5=90=AB=E8=8B=B1=E6=96=87?= =?UTF-8?q?=E8=88=87=E6=97=A5=E6=96=87=E7=9A=84=20README=20=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 187 +++++++++++++++++++++++---------------------------- README_en.md | 112 ++++++++++++++++++++++++++++++ README_jp.md | 110 ++++++++++++++++++++++++++++++ 3 files changed, 305 insertions(+), 104 deletions(-) create mode 100644 README_en.md create mode 100644 README_jp.md diff --git a/README.md b/README.md index a6b0e8a..dc29e38 100644 --- a/README.md +++ b/README.md @@ -1,122 +1,101 @@ -ComfyUI Dynamic Tag & LoRA Manager +

+ ComfyUI_Dynamic_TagLoader +

-旨在解決 Prompt 管理與 LoRA 組合繁瑣的問題。它包含兩個核心節點:Saver(存檔) 與 Loader(讀取與生成)。 +## 🔗 Quick Links -ComfyUI_Dynamic_TagLoader_01 +* [English Version](./README_en.md) +* [日本語版](./README_jp.md) +* [中文版](./README.md) -透過這個插件,您可以將常用的 Prompt 與 LoRA 設定儲存為模組化的文本,並在生成時透過「排列組合」的方式,自動讀取文本中的 LoRA 標籤並掛載模型,實現高效率的批量生成。 -✨ 主要功能 (Key Features) -💾 Dynamic Tag Saver (動態標籤存檔器) -視覺化 LoRA 管理:透過 UI 下拉選單直接選擇系統內的 LoRA,並調整權重。 +ComfyUI_Dynamic_TagLoader_01 -自動格式化:將 Prompt 與 LoRA 設定自動合併,存成 .txt 檔案。 +## 安裝說明 (Installation) -分類管理:支援自定義資料夾與檔名,自動處理檔名衝突(流水號)。 +進入 ComfyUI custom_nodes 目錄: -搜尋功能:內建 LoRA 搜尋選單,快速找到您需要的模型。 - -⚡ Dynamic Tag Loader (動態標籤讀取器) -自動掛載 LoRA:讀取文本時,自動解析 語法,並直接將 LoRA 應用到 MODEL 與 CLIP 輸出,無需手動連接多個 LoRA Loader。 - -排列組合生成 (Batch Generator): - -支援多組標籤輸入。 - -若選擇「資料夾 (ALL)」,會自動讀取該資料夾下所有檔案。 - -自動計算所有組合,例如:背景組(3個檔案) x 角色組(4個檔案) = 一次生成 12 張不同組合的圖片。 - -模糊搜尋機制:即便存檔時的 LoRA 路徑與當前環境不同,插件也會嘗試透過檔名自動尋找對應的 LoRA 模型。 - -全域 Prompt:支援輸入固定的一段文字(如畫質修飾詞),會自動添加到所有生成的組合最前方。 - -📦 安裝說明 (Installation) -進入您的 ComfyUI custom_nodes 目錄: - -Bash -``` +```bash cd ComfyUI/custom_nodes/ -``` - -Bash - -``` git clone https://github.com/NineKey1028/ComfyUI_Dynamic_TagLoader.git + ``` 重新啟動 ComfyUI。 -📖 使用教學 (Usage Guide) -1. 💾 Dynamic Tag Saver -這個節點用於將您的靈感保存下來。 +### ⚡Dynamic Tag Loader +> 快速的讀取、排序 tag 資料夾中整理好的 .txt 文件,同時支持 LoRa 讀取,與 🔄 Dynamic Tag Iterator 連接後可支持 prompt 隨機、批量輸出 +>
+> 更多... +> +> * **Global Prompt**:輸出時會處於所有組合的第一行。 +> * **\+ Add Tag Group**:點擊新增讀取的資料夾,可依需求添加無數個組合。 +> * **Tag Group**: +> * **Folder**:目前讀取的資料夾,點擊可打開資料夾選單切換資料夾。 +> * **File**:目前資料夾下所讀取的檔案,選擇第一行 ALL 選項時會將此資料夾中所有的 .txt 與其它組的 .txt 進行組合排序並全部輸出。 +> * **LoRA 讀取**:支援在 .txt 檔案或 Global Prompt 中直接編寫 。節點會自動提取語法、加載模型權重,並從最終輸出的提示詞中清理該語法。 +> * **右鍵選單**:在任一 Tag Group 區塊點擊右鍵,可呼叫專屬選單進行「上移/下移」、「置頂/置底」、「向前/向後插入新組」或「刪除該組」等排序操作。 +>
-Text Input: 輸入您的主要 Prompt。 +### 🔄 Dynamic Tag Iterator +> 接收來自 Dynamic Tag Loader 的組合列表,並根據設定進行單次迭代或批量輸出。 +>
+> 更多... +> +> * **Output Mode**: +> * **Iterate (One by One)**:配合 ComfyUI 的隊列機制,每次執行僅輸出組合中的一項(依據 Seed 進行索引順序切換)。 +> * **Batch (List)**:一次性輸出所有組合(或篩選後的列表),適用於支持 List 處理的後續節點。 +> * **Sample Limit**:抽樣限制功能。設為 0 時使用所有組合;若大於 0,則會根據目前的 Seed 從所有組合中隨機抽取指定數量的項進行輸出。 +> * **Seed 控制與記錄**: +> * 節點會根據輸入的 Seed 決定迭代的索引或隨機抽樣的順序。 +> * **♻️ Reuse Last Seed**:UI 面板會自動記錄上一次成功執行時使用的 Seed。點擊按鈕可快速將該數值填回 Seed 輸入框,方便復現特定的隨機組合。 +>
-Folder / Filename: 設定存檔的資料夾與檔名(檔案將存於插件目錄下的 tags/ 資料夾中)。 +### 💾 Dynamic Tag Saver +> 將 Prompt 文本即時保存為 .txt 標籤檔案,並自動整合所選的 LoRA 語法。此節點能幫助使用者快速建立個人標籤庫,方便未來透過 Dynamic Tag Loader 重新讀取與組合。 +>
+> 更多... +> +> * **Text Input**:主要的提示詞輸入區塊。存檔時會自動移除前後多餘空格。 +> * **Folder & Filename**: +> * **Folder Name**:指定存檔的資料夾名稱,若目錄不存在會自動創建(位於節點目錄下的 `tags` 資料夾中)。 +> * **Filename**:指定檔案名稱。若資料夾內已存在同名檔案,會自動添加流水號(如 `_1`, `_2`),防止覆蓋既有資料。 +> * **LoRA Auto Merge (▼ LoRA Auto Merge ▼)**: +> * **+ Add LoRA**:點擊開啟搜尋選單,從系統中選擇安裝好的 LoRA 檔案。 +> * **Strength**:調整該 LoRA 的權重數值(支援 -10.0 至 10.0)。 +> * **自動語法整合**:存檔時,節點會將選擇的 LoRA 自動轉換為標準 Prompt 語法 `` 並附加在文本末端。 +> * **右鍵進階選單**:在 LoRA 區塊點擊右鍵,可進行「置頂/置底」、「排序移動」或「插入/刪除」等操作,靈活調整 LoRA 的寫入順序。 +>
-+ Add LoRA: +### 🔍 Workflow Metadata Reader +> 用於從生成的圖片(PNG)中回溯提取完整的 Workflow JSON 數據與並依工作流ID抓取內容並輸出prompt、圖片。支持單圖解析、資料夾批量隨機選取。 +>
+> 更多... +> +> * **image_or_dir**:可輸入圖片或資料夾路徑。 +> * **Search By**: +> * **ID**:透過節點 ID 定位並提取該節點的所有 Widget 數值(如 Prompt、Seed 等)。 +> * **Type**:透過節點類型(如 `CLIPTextEncode`)過濾並提取匹配的文本內容。 +> * **檔案選取邏輯**: +> * **資料夾模式**:輸入資料夾路徑,並配合 **Seed** 進行隨機索引抽樣,適合用於自動化重新讀取不同圖片的提示詞。 +> * **單圖模式**:直接讀取指定路徑的圖片資訊。 +> 可直接將圖片檔案拖入節點並填寫圖片路徑。 +> 可從剪貼簿直接 `Ctrl+V` 貼上圖片。 +> 上敘兩項動作會將圖片複製至input資料夾 +> ⚠️ **注意事項**: +> 正確讀取 Prompt 的前提是該流程中需使用類似 **Show Text** 的節點來顯示提示詞,且 **Prompt 必須先於圖片產生**(即寫入 Metadata 中),否則可能會讀取到錯誤資訊。若遇到執行順序問題,建議搭配 **⏳ Wait For** 節點來強制控制產生順序。 +>
-點擊按鈕開啟選單。 +### ⏳ Wait For +> 用於強制控制工作流的執行順序。在 ComfyUI 的非線性執行環境中,確保特定節點必須在「目標節點」完成後才開始運算,解決異步執行導致的順序錯誤問題。 +>
+> 更多... +> +> * **Data Input**:主要流轉的數據(支援任何類型 AnyType),此數據將被原樣輸出。 +> * **Wait For (Optional)**:連接你希望先執行的節點輸出。當此連接點有數據傳入時,`Wait For` 才會釋放 `Data Input` 給後續節點。 +>
-可關鍵字搜尋。 - -加入後可調整強度 (Strength),支援右鍵選單進行排序 (Move Up/Down) 或刪除。 - -執行: 連接任意輸出並執行 Prompt,檔案即會建立。 - -ComfyUI_Dynamic_TagLoader_02 - - - -2. ⚡ Dynamic Tag Loader -這個節點是核心,它是一個 Generator,可直接連接到 KSampler。 - -Global Prompt: 輸入通用的 Prompt(例如 masterpiece, best quality),這段文字會加在所有組合的最前面。 - -+ Add Tag Group: - -選擇一個資料夾 (Folder)。 - -選擇一個檔案 (File),或選擇 "ALL" 來讀取該資料夾內所有檔案。 - -您可以新增多個群組,節點會自動將它們混合搭配。 - -輸出連接: - -MODEL / CLIP: 已自動掛載好 LoRA 的模型,直接連到 KSampler。 - -STRING: 組合後的完整 Prompt,連到 CLIP Text Encode。 - -🚀 工作流範例 (Workflow Example) -場景:您想要測試 3 種不同的服裝 LoRA,配合 2 種不同的背景 Prompt。 - -ComfyUI_Dynamic_TagLoader_03 - -[圖中使用的Lora](https://civitai.com/models/2250459/zhao-zenless-zone-zero-illustrious) - -使用 Saver: - -建立資料夾 Costumes,分別儲存 3 個檔案(包含對應的 LoRA 設定)。 - -建立資料夾 Backgrounds,分別儲存 2 個背景描述檔。 - -使用 Loader: - -Group 1 選擇 Costumes -> ALL。 - -Group 2 選擇 Backgrounds -> ALL。 - -執行: - -Loader 會自動輸出 3 x 2 = 6 組變數。 - -ComfyUI 將自動連續生成 6 張圖片,每張圖都應用了正確的 LoRA 和背景。 - -⚠️ 注意事項 -Batch Size: 由於 Loader 輸出的是列表(List),請確保後續節點支援批次處理。通常 ComfyUI 會自動處理列表執行。 - -LoRA 路徑: 雖然內建模糊搜尋,但建議保持 LoRA 檔案名稱的一致性以確保讀取正確。 - -License -MIT License +範例工作流: +![example](./example/Dynamic_Tag_example_workflow.png) +![example](./example/Workflow_Metadata_Reader_example_workflow.png) +可拖入 comfyUI 讀取範例工作流 diff --git a/README_en.md b/README_en.md new file mode 100644 index 0000000..c08a70d --- /dev/null +++ b/README_en.md @@ -0,0 +1,112 @@ +

+ ComfyUI_Dynamic_TagLoader +

+ +## 🔗 Quick Links + +* [English Version](./README_en.md) +* [日本語版](./README_jp.md) +* [中文版](./README.md) + + +ComfyUI_Dynamic_TagLoader_01 + + +## Installation + +Navigate to your ComfyUI `custom_nodes` directory: + +```bash +cd ComfyUI/custom_nodes/ +git clone https://github.com/NineKey1028/ComfyUI_Dynamic_TagLoader.git + +``` + +Restart ComfyUI. + +### ⚡ Dynamic Tag Loader +> Quickly read and sort organized `.txt` files from tag folders. Supports LoRA reading and can be connected to the 🔄 **Dynamic Tag Iterator** for random prompts and batch output. +>
+> More... + +> * **Global Prompt**: Always appears on the first line of all output combinations. +> * **+ Add Tag Group**: Click to add a new folder to read; you can add unlimited groups as needed. +> * **Tag Group**: +> * **Folder**: The current folder being read. Click to open a menu and switch folders. +> * **File**: The file currently selected in the folder. Choosing **ALL** will combine all `.txt` files in this folder with files from other groups for full combinatorial output. +> +> +> * **LoRA Support**: Supports writing `` directly in `.txt` files or the Global Prompt. The node automatically extracts the syntax, loads model weights, and cleans the syntax from the final prompt. +> * **Context Menu**: Right-click any Tag Group to "Move Up/Down," "Move to Top/Bottom," "Insert New Group," or "Delete Group." +>
+ +### 🔄 Dynamic Tag Iterator +> Receives the combination list from the Dynamic Tag Loader and performs single iterations or batch outputs based on settings. +>
+> More... + +> * **Output Mode**: +> * **Iterate (One by One)**: Works with ComfyUI's queue mechanism. Outputs one combination per execution (switches index order based on Seed). +> * **Batch (List)**: Outputs all combinations (or a filtered list) at once, suitable for nodes that support list processing. +> +> +> * **Sample Limit**: Sampling restriction. Set to 0 to use all combinations; if > 0, it randomly selects a specified number of items from the pool based on the current Seed. +> * **Seed Control & Records**: +> * The node determines the iteration index or random sampling order based on the Seed. +> * **♻️ Reuse Last Seed**: Automatically records the Seed from the last successful run. Click to quickly fill it back into the Seed input to reproduce specific combinations. +>
+ +### 💾 Dynamic Tag Saver +> Saves prompt text instantly as a `.txt` tag file and automatically integrates selected LoRA syntax. Helps users build personal tag libraries for future use with the Dynamic Tag Loader. +>
+> More... + +> * **Text Input**: The main prompt input area. Extra spaces are trimmed automatically. +> * **Folder & Filename**: +> * **Folder Name**: Specify the save directory. If it doesn't exist, it will be created (within the `tags` folder in the node directory). +> * **Filename**: Specify the file name. If a duplicate exists, a suffix (e.g., `_1`, `_2`) is added to prevent overwriting. +> +> +> * **LoRA Auto Merge**: +> * **+ Add LoRA**: Opens a search menu to select installed LoRA files. +> * **Strength**: Adjust weights (supports -10.0 to 10.0). +> * **Auto Integration**: Upon saving, selected LoRAs are converted to `` and appended to the text. +> +> +> * **Advanced Menu**: Right-click the LoRA block to reorder or delete entries. +>
+ +### 🔍 Workflow Metadata Reader +> Extracts complete Workflow JSON data from generated images (PNG). It retrieves content based on Node IDs to output prompts and images. Supports single image parsing or random selection from a directory. +>
+> More... + +> * **image_or_dir**: Input a file path or a directory path. +> * **Search By**: +> * **ID**: Locates and extracts all widget values (Prompt, Seed, etc.) via Node ID. +> * **Type**: Filters and extracts text based on node type (e.g., `CLIPTextEncode`). +> +> +> * **Selection Logic**: +> * **Directory Mode**: Uses the **Seed** to randomly sample images from a folder. +> * **Single Image Mode**: Reads info from a specific file. +> +> +> * **Note**: Supports Drag & Drop or `Ctrl+V` to paste images (copies them to the `input` folder). +> ⚠️ **Warning**: For prompts to be read correctly, the workflow should use a node like **Show Text** and the prompt must be written to the metadata *before* image generation. If execution order issues occur, use the **⏳ Wait For** node. +>
+ +### ⏳ Wait For + +> Forces execution order in ComfyUI's non-linear environment. Ensures a "Target Node" finishes before the subsequent node begins. +>
+> More... + +> * **Data Input**: The primary data to pass through (AnyType). +> * **Wait For (Optional)**: Connect to the output of the node you want to finish first. Data is only released once this connection receives data. +>
+ +ワークフローの例: +![example](./example/Dynamic_Tag_example_workflow.png) +![example](./example/Workflow_Metadata_Reader_example_workflow.png) +これらの画像を ComfyUI にドラッグ&ドロップすることで、サンプルワークフローを読み込むことができます。 \ No newline at end of file diff --git a/README_jp.md b/README_jp.md new file mode 100644 index 0000000..4d08cb0 --- /dev/null +++ b/README_jp.md @@ -0,0 +1,110 @@ +

+ ComfyUI_Dynamic_TagLoader +

+ +## 🔗 Quick Links + +* [English Version](./README_en.md) +* [日本語版](./README_jp.md) +* [中文版](./README.md) + + +ComfyUI_Dynamic_TagLoader_01 + +## インストール + +ComfyUI の `custom_nodes` ディレクトリに移動します: + +```bash +cd ComfyUI/custom_nodes/ +git clone https://github.com/NineKey1028/ComfyUI_Dynamic_TagLoader.git + +``` + +ComfyUI を再起動してください。 + +### ⚡ Dynamic Tag Loader +> 整理されたタグフォルダから `.txt` ファイルを高速に読み込み、ソートします。LoRA の読み込みにも対応しており、🔄 **Dynamic Tag Iterator** と接続することで、プロンプトのランダム化やバッチ出力が可能です。 +>
+> 詳細... + +> * **Global Prompt**: すべての組み合わせの先頭に出力されます。 +> * **+ Add Tag Group**: クリックして読み込むフォルダを追加します。必要に応じて無制限に追加可能です。 +> * **Tag Group**: +> * **Folder**: 現在読み込んでいるフォルダ。クリックしてフォルダを切り替えられます。 +> * **File**: 現在のフォルダ内で読み込まれているファイル。「ALL」を選択すると、このフォルダ内のすべての `.txt` が他のグループのファイルと組み合わされ、全パターンが出力されます。 +> +> +> * **LoRA 読み込み**: `.txt` ファイルまたは Global Prompt 内に `` を直接記述できます。ノードが自動的に構文を抽出してモデルウェイトをロードし、最終的なプロンプトからは構文を削除します。 +> * **右クリックメニュー**: Tag Group 領域を右クリックして、「上へ/下へ移動」、「最上部/最下部へ」、「新しいグループを挿入」、「削除」などの操作が可能です。 +>
+ +### 🔄 Dynamic Tag Iterator +> Dynamic Tag Loader から組み合わせリストを受け取り、設定に基づいて単一のイテレーションまたはバッチ出力を行います。 +>
+> 詳細... + +> * **Output Mode**: +> * **Iterate (One by One)**: ComfyUI のキュー機能と連動し、実行ごとに組み合わせを1つずつ出力します(Seed に基づいて順序を切り替え)。 +> * **Batch (List)**: すべての組み合わせ(またはフィルタリング後のリスト)を一度に出力します。リスト処理に対応したノードに最適です。 +> +> +> * **Sample Limit**: サンプリング制限機能。0 の場合はすべての組み合わせを使用します。0 より大きい場合、現在の Seed に基づいて指定された数だけランダムに抽出します。 +> * **Seed コントロールと記録**: +> * Seed によってイテレーションのインデックスやランダムサンプリングの順序が決定されます。 +> * **♻️ Reuse Last Seed**: 直前の成功した実行で使用された Seed を自動記録します。ボタンをクリックして Seed 入力欄に値を戻し、特定の組み合わせを再現できます。 +>
+ +### 💾 Dynamic Tag Saver +> プロンプトテキストを即座に `.txt` タグファイルとして保存し、選択した LoRA 構文を自動的に統合します。個人用のタグライブラリを構築し、将来的に Dynamic Tag Loader で再利用するのに便利です。 +>
+> 詳細... + +> * **Text Input**: メインのプロンプト入力エリア。保存時に前後の不要な空白を自動削除します。 +> * **Folder & Filename**: +> * **Folder Name**: 保存先フォルダ名。存在しない場合は自動生成されます(ノードディレクトリ内の `tags` フォルダ内)。 +> * **Filename**: ファイル名。同名ファイルがある場合は自動で連番(`_1`, `_2`)が付与されます。 +> +> +> * **LoRA Auto Merge**: +> * **+ Add LoRA**: クリックしてインストール済みの LoRA ファイルを検索・選択します。 +> * **Strength**: ウェイト値を調整します(-10.0 ~ 10.0 対応)。 +> * **自動構文統合**: 保存時、選択した LoRA は標準のプロンプト構文 `` に変換され、テキストの末尾に追加されます。 +> +> +> * **右クリックメニュー**: LoRA ブロックを右クリックして、順序の変更や削除が可能です。 +>
+ +### 🔍 Workflow Metadata Reader +> 生成された画像(PNG)から完全な Workflow JSON データを抽出します。ノード ID に基づいてプロンプトや画像を取得し、単一画像の解析やフォルダからのランダム選択に対応しています。 +>
+> 詳細... + +> * **image_or_dir**: 画像ファイルまたはフォルダのパスを入力します。 +> * **Search By**: +> * **ID**: ノード ID を通じて、そのノードの全ウィジェット値(プロンプト、Seed など)を抽出します。 +> * **Type**: ノードタイプ(例: `CLIPTextEncode`)を指定してテキスト内容を抽出します。 +> +> +> * **画像選択ロジック**: +> * **フォルダモード**: フォルダパスを入力し、**Seed** を利用してランダムに画像をサンプリングします。 +> * **単一画像モード**: 指定した画像の情報を直接読み込みます。 +> +> +> * **ヒント**: 画像をノードにドラッグ&ドロップするか `Ctrl+V` で貼り付けることができます(`input` フォルダにコピーされます)。 +> ⚠️ **注意**: プロンプトを正しく読み込むには、ワークフロー内で **Show Text** のようなノードを使用し、画像生成前にプロンプトがメタデータに書き込まれている必要があります。順序の問題が発生する場合は **⏳ Wait For** ノードを使用してください。 +>
+ +### ⏳ Wait For +> ComfyUI の非線形実行環境で実行順序を強制制御します。特定のノードが完了してから次の計算を開始するように調整し、非同期実行によるエラーを防ぎます。 +>
+> 詳細... + +> * **Data Input**: 次に渡すメインデータ(AnyType 対応)。そのまま出力されます。 +> * **Wait For (Optional)**: 先に実行を完了させたいノードの出力を接続します。この接続点にデータが届くまで、`Data Input` は次へ放出されません。 +>
+ +ワークフローの例: +![example](./example/Dynamic_Tag_example_workflow.png) +![example](./example/Workflow_Metadata_Reader_example_workflow.png) +これらの画像を ComfyUI にドラッグ&ドロップすることで、サンプルワークフローを読み込むことができます。 \ No newline at end of file