Danbooru Tag JP Assist
Japanese-assisted tag autocomplete for ComfyUI text areas. Supports Danbooru tags, bundled natural language tags, local CSV tag files, Japanese aliases, popup settings, and optional Danbooru CSV update from Hugging Face.
Danbooru Tag JP Assist
Danbooru Tag JP Assist は、ComfyUI ノードの複数行テキスト入力欄でタグ候補を表示する補完ノードです。
日本語で検索しながら、英語タグや英語の自然言語ワードをプロンプトへ入力できます。
配布
正式版は GitHub Releases から取得できます。Comfy Registryへの公開・審査状態はGitHub ActionsとRegistry側で確認してください。Git cloneからのインストールも利用できます。
- Node ID:
danbooru-tag-jp-assist - Publisher ID:
ukr8b3g-cmyk - バージョン:
0.2.0 - ComfyUI の Python 環境で動作します。
serverとaiohttpは ComfyUI 側の環境を使用するため、追加の pip 依存は宣言していません。 - 配布には本体 Python、
web/、下記の同梱タグ5件・翻訳2件のCSV、README、LICENSE、THIRD_PARTY_NOTICES を含めます。.comfyignoreは実行時ダウンロード、取得メタデータ、一時ファイル、利用者が追加したデータを除外します。公開準備は利用者データのないクリーンな checkout で行ってください。 - MIT はソースコードに適用され、第三者データの利用条件を置き換えません。THIRD_PARTY_NOTICES.md を参照してください。
インストール
ComfyUI を停止してから、custom_nodes に clone します。
cd D:\Codex\ComfyUI\custom_nodes
git clone https://github.com/ukr8b3g-cmyk/Danbooru-Tag-JP-Assist.git Danbooru-Tag-JP-Assist
すでにフォルダーがある場合は、通常は fast-forward のみで更新します。
cd D:\Codex\ComfyUI\custom_nodes\Danbooru-Tag-JP-Assist
git pull --ff-only
ローカルでコードを編集しておらず、ブランチが分岐して更新できない場合は、GitHub の origin/main を正本として同期できます。
git fetch origin
git reset --hard origin/main
git reset --hard origin/mainはローカルの未コミット変更・ローカルのみのコミットを破棄します。必要な変更がある場合は先に退避してください。
その後、ComfyUI を再起動し、古いUIが残る場合はブラウザを Ctrl + F5 でハード更新してください。
できること
- ComfyUI ノードの複数行テキスト欄でタグ候補を表示します。
- 日本語の別名や翻訳から英語タグを検索できます。
- 英語タグをプロンプトへ挿入します。
_を空白に置き換えて、Krea系の自然言語プロンプト風に入力できます。- カンマを自動で追加できます。
- 一致順、優先度/count順、A-Z順で並び替えできます。
- Danbooruタグ、自然言語辞書、自分のCSVを併用できます。
- 個別の
Tag file (priority)を選ぶと、そのCSVの一致候補を最優先し、足りない分だけTag sourceで有効な他ファイルから補完します。 - 候補挿入時に既存の改行・空行・インデント・前後スペースを保持できます。
- Hugging Face の Danbooru CSV を起動時に確認し、更新があればローカルの
danbooru_tags.csvを更新できます。 - 検索はサーバー側で行い、必要な候補だけをブラウザへ返します。
- 入力検索は80msデバウンスされ、候補の上下移動ではリスト全体を再描画しません。
All は複数のタグファイルや翻訳ファイルをまとめて使う簡単なモードです。個別ファイルを選んだ場合は「そのファイルだけ」に限定せず、選択ファイルを優先しつつ他の有効なソースをフォールバックとして利用します。
Hugging Face がオフライン、または元ファイルが消えている場合は、既存のローカルCSVをそのまま使います。
基本的な使い方
- ComfyUI の Settings を開きます。
Danbooru Tag JP Assistを有効にします。- まずは
Tag file (priority): All、Translation file: Allのまま使います。 - ノードの複数行プロンプト欄に英語または日本語を入力します。
- 候補をキーボードまたはマウスで選択します。
初期設定では以下の動作になります。
Tag file (priority): Allはtags/tag_files/内の同梱CSVと、ローカルにある Danbooru CSV をまとめて検索します。- 個別の
Tag file (priority)を選ぶと、そのファイルの一致候補が先に並び、候補上限に余りがある場合はTag sourceで有効な他ファイルから補完します。 Translation file: Allは同梱の翻訳CSVをまとめて読みます。Tag source: Bothはローカルファイルと Hugging Face 由来の Danbooru CSV を併用します。- 同じタグが選択中の優先ファイルと他ファイルの両方にある場合は、優先ファイル側の行を採用します。優先ファイルを指定していない
Allでは、従来どおり後から読み込まれる Danbooru CSV 側が重複時に優先されます。 natural_language_tags.csvは軽量な英語辞書・プロンプト語彙です。Danbooruタグの代替ではありません。merged_translations_dedup.csvは Danbooru タグ用の日本語別名です。natural_language_ja.csvは自然言語辞書用の日本語別名です。- CSVはサーバー側でキャッシュされます。大きな
All構成では最初の検索だけ読み込みに時間がかかる場合があります。
ファイル構成
タグファイルと翻訳ファイルは別フォルダーに置きます。
tags/tag_files/: 英語タグ・英語辞書CSVを置くフォルダーtags/translation_files/: 日本語翻訳・別名CSVを置くフォルダー
現在の同梱タグファイル:
tags/tag_files/anima_artists.csvtags/tag_files/anima_characters.csvtags/tag_files/danbooru_2025.csvtags/tag_files/e621.csvtags/tag_files/natural_language_tags.csv: 軽量な英語辞書・プロンプト語彙
同梱翻訳ファイル:
tags/translation_files/natural_language_ja.csv: 自然言語辞書の一部に対応した日本語別名tags/translation_files/merged_translations_dedup.csv: Danbooruタグ用の日本語別名
同梱しないファイル:
tags/tag_files/danbooru_tags.csv: Hugging Face から実行時に取得します。Gitには含めません。
CSV形式
ヘッダー付きCSVに加え、ヘッダーなしの tag,category,count,aliases 形式も読み込めます。ヘッダーなしの4列目は別名として扱う位置で、挿入モードには使いません。不正なCSVはファイル単位で除外し、正常な辞書と通常入力を継続します。
Settings → Danbooru Tag JP Assist 内の Completion behavior は初期値 Existing です。CSV-aware を選ぶと、CSVの任意列 source_type (tag / natural_language / custom)、insert_mode (tag / phrase / word / raw)、category_scheme を利用します。tag と phrase は既存のカンマ設定、word は空白のみ、raw はセルの文字列を変換せず挿入します。自然言語の word は複数語にも使えます。列のない利用者CSVは従来動作を維持し、同梱 natural_language_tags.csv はCSV-aware時に natural_language / word として扱います。
日本語表示と Use JP aliases for search は独立しています。Show TAG / NL / CUSTOM、Show source CSV、Show post count は初期OFFです。投稿数は確認できる辞書由来の値だけを表示し、0件と不明を区別します。同名タグの優先CSV・Allでの採用順は維持し、別の辞書の投稿数やカテゴリを混ぜません。
Underscore exclusions は score_* などのglobパターンをカンマまたは改行で指定できます。挿入文字列だけを保護し、ワイルドカードの実行はしません。Reload dictionaries はサーバーとブラウザーの検索キャッシュを無効化します。CSVの追加・削除後にファイル選択肢も更新する場合はブラウザーを再読込してください。
IME変換中の確定キーは補完で消費しません。Escape、選択位置変更、設定変更、ノード削除で古い候補を無効化し、補完確定前にも入力と位置を確認します。通常のChromiumではネイティブ編集を使ってUndo履歴を保持します。他ブラウザーの代替編集経路はUndo対応を保証しません。
タグファイル:
tag,category,count
1girl,0,4974288
long_hair,0,3608339
tag: プロンプトへ挿入される英語タグcategory: Danbooru互換のカテゴリ番号count: 優先度や人気順ソートに使う数値
翻訳ファイル:
tag,ja,aliases
1girl,"少女,女の子,おんなのこ","少女,女の子,若い女性,girl"
long_hair,"長髪,ロングヘア","長髪,ロングヘア,髪が長い"
tag: 対応する英語タグja: 日本語表示用テキストaliases: 検索用の日本語別名。複数ある場合はカンマ区切り
Tag file (priority) の動作
個別CSVを選んでも検索範囲はその1ファイルだけにはなりません。選択CSVの一致候補に優先度0、フォールバック候補に優先度1を付け、Sort mode の並び順より先に優先度を評価します。
たとえば Suggestion count = 20 で、選択CSVに検索語と一致する候補が7件しかない場合、先頭7件は選択CSVから出し、残り最大13件を Tag source で有効な他CSVから補完します。選択CSVだけで20件以上一致すれば、表示上は選択CSVの候補だけになります。
主な設定
タグ・翻訳の各 Selection mode で Selected CSVs only を選ぶと、チェックしたCSVだけを選択順に使用します。↑ / ↓ で優先順位を変更できます。空の選択は候補・翻訳なしです。旧 Tag source / Tag file (priority) / Translation file は表示を維持しますが、選択モードでは対応する旧設定を使用しません。
Tag file (priority):tags/tag_files/内の1ファイル、またはAll。初期値はAllです。個別ファイルを選ぶと、そのファイルの一致候補を優先し、候補が足りない場合はTag sourceで有効な他ファイルから補完します。Translation file:tags/translation_files/内の1ファイル、またはAll。Update Danbooru CSV from Hugging Face: Hugging Face 側を確認し、変更があればdanbooru_tags.csvを更新します。List every match: 候補を多めに表示します。上限は500件です。Suggestion count:List every matchがOFFの時の表示数です。Sort mode:Match first、Priority / count、Tag A-Z。Popup color: 候補ポップアップの色です。Use spaces for underscores:long_hairをlong hairとして挿入します。Append comma: 候補挿入後にカンマを追加します。Preserve prompt formatting: 初期値はONです。候補挿入時に既存の改行・空行・インデント・前後スペースを保持します。OFFでは従来の自動整形動作になります。
入力検索は80msデバウンスされ、候補の上下移動ではリスト全体を再描画しません。Hugging Face のCSV更新確認もUI初期化をブロックせずバックグラウンドで実行されます。
CSVを追加・削除したあと、Settings のリストが更新されない場合は ComfyUI を再起動してください。
注意
-
Settings → pysssss → Text Autocompleteと併用すると、Embeddingなどの別候補が重なったり、スクロールバー操作でJP Assist候補が閉じる場合があります。その場合はpysssss側のText AutocompleteをOFFにしてください。JP AssistはEmbedding / LoRA候補を自動取得しません。 -
補完対象は ComfyUI ノードに属する複数行テキスト欄です。Settings や一般的なモーダル内の textarea には取り付けません。
-
GitHubリポジトリには
danbooru_tags.csvを含めません。 -
ダウンロード済みの
danbooru_tags.csvは、元のファイル名と内容を維持します。 -
Hugging Face からの更新は一時ファイルへストリーミング保存し、CSVヘッダーを確認してから置き換えます。
-
Hugging Face から自動取得するCSVには128 MiBの上限を設けています。
-
自分のタグファイルは
tags/tag_files/に置いてください。 -
自分の翻訳・別名ファイルは
tags/translation_files/に置いてください。 -
Allで大きなCSVを複数読む場合、初回検索時は単一CSVより読み込みに時間がかかる場合があります。 -
タグファイルがない場合、候補ポップアップは表示されません。
ライセンス
ソースコードは MIT License で公開しています。
同梱するタグ・翻訳データには、改変した第三者データが含まれる場合があります。出典と利用条件は THIRD_PARTY_NOTICES.md を参照してください。
English README
Danbooru Tag JP Assist adds tag suggestions to multiline text areas that belong to ComfyUI nodes.
It is intended for users who want to search English Danbooru tags and English prompt vocabulary with optional Japanese aliases.
Distribution
Stable versions are available from GitHub Releases. Check GitHub Actions and Comfy Registry for publication and review status. Git clone installation is also supported.
- Node ID:
danbooru-tag-jp-assist - Publisher ID:
ukr8b3g-cmyk - Version:
0.2.0 - Runs inside ComfyUI's Python environment. ComfyUI supplies
serverandaiohttp, so no additional pip dependencies are declared. - The distribution includes the Python implementation,
web/, the five bundled tag CSVs and two translation CSVs listed below, README, LICENSE, and THIRD_PARTY_NOTICES..comfyignoreexcludes runtime downloads, download metadata, temporary files, and user-added data. Prepare any publication from a clean checkout without user data. - MIT applies to the source code and does not replace third-party data terms. See THIRD_PARTY_NOTICES.md.
Installation
Stop ComfyUI, then install into custom_nodes:
cd D:\Codex\ComfyUI\custom_nodes
git clone https://github.com/ukr8b3g-cmyk/Danbooru-Tag-JP-Assist.git Danbooru-Tag-JP-Assist
If the folder already exists, normally update with fast-forward only:
cd D:\Codex\ComfyUI\custom_nodes\Danbooru-Tag-JP-Assist
git pull --ff-only
If you do not keep local code changes and the local branch has diverged, you can sync it exactly to GitHub origin/main:
git fetch origin
git reset --hard origin/main
git reset --hard origin/maindiscards uncommitted changes and local-only commits. Back up anything you need first.
Restart ComfyUI and hard refresh the browser with Ctrl + F5.
What It Does
- Shows suggestions while typing in multiline text boxes that belong to ComfyUI nodes.
- Inserts English tags into the prompt.
- Can display Japanese aliases next to suggestions.
- Can insert spaces instead of underscores for Krea-style natural prompts.
- Supports sorting by match, priority/count, or tag name.
- Supports local tag files, Hugging Face tag files, or both.
- Selecting a specific
Tag file (priority)prioritizes matches from that CSV and fills any remaining slots from other sources enabled byTag source. - Can preserve existing line breaks, blank lines, indentation, and surrounding spaces when inserting a suggestion.
- Can check the Hugging Face source at startup and download/update the local
danbooru_tags.csvwhen the remote file changes. - Performs matching on the server and sends only the requested suggestions to the browser.
- Debounces input searches by 80 ms and updates keyboard selection without rebuilding the full suggestion list.
All is the simplest combined mode. Selecting a specific file no longer acts as a hard single-file filter: the selected file is treated as the priority source and other enabled sources remain available as fallback.
If Hugging Face is offline or the source file disappears, the node keeps using the local saved CSV.
Basic Use
- Open ComfyUI Settings.
- Enable
Danbooru Tag JP Assist. - Use the default
Tag file (priority): AllandTranslation file: Allfirst. - Type English or Japanese text in a multiline prompt box on a node.
- Select a suggestion with the keyboard or mouse.
Default behavior:
Tag file (priority): Allsearches bundled CSV files undertags/tag_files/plus the local Danbooru CSV when available.- Selecting a specific
Tag file (priority)puts matches from that file first, then fills unused result slots from other files enabled byTag source. Translation file: Allloads the bundled translation CSV files together.Tag source: Bothuses local files and the Hugging Face Danbooru CSV together.- If a tag exists in both the selected priority file and fallback files, the selected file wins. With
Alland no explicit priority file, the later-loaded Danbooru CSV keeps the existing duplicate-resolution behavior. natural_language_tags.csvis a lightweight English dictionary and prompt vocabulary, not a Danbooru tag replacement.merged_translations_dedup.csvis for Danbooru tag Japanese aliases.natural_language_ja.csvis only for the natural language dictionary.- CSV data is cached on the server. A large
Allconfiguration may take longer on the first search while the cache is built.
Tag Files
Use two separate folders:
tags/tag_files/: English tag files.tags/translation_files/: Japanese translation or alias files.
Currently bundled tag files:
tags/tag_files/anima_artists.csvtags/tag_files/anima_characters.csvtags/tag_files/danbooru_2025.csvtags/tag_files/e621.csvtags/tag_files/natural_language_tags.csv: lightweight English dictionary and prompt vocabulary
Bundled translation files:
tags/translation_files/natural_language_ja.csv: Japanese aliases for part of the natural language dictionary.tags/translation_files/merged_translations_dedup.csv: Japanese aliases for Danbooru tags.
Not bundled:
tags/tag_files/danbooru_tags.csv: downloaded from Hugging Face at runtime.
CSV Format
Headerless tag,category,count,aliases files are supported; the fourth column is not an insertion mode. Malformed files are isolated from healthy dictionaries.
All controls remain in Settings → Danbooru Tag JP Assist. Completion behavior defaults to Existing. Opt into CSV-aware to use optional source_type, insert_mode, and category_scheme columns. tag / phrase follow the comma preference, word inserts without a comma (including multi-word phrases), and raw preserves the decoded cell text. User CSVs without these columns retain tag behavior; the bundled natural-language dictionary uses word behavior in CSV-aware mode.
Japanese search and display are independent. Source labels, source filenames and post counts default to hidden. Zero and unknown counts are distinct, and metadata belongs to the winning CSV row. Underscore exclusions accept comma/newline-separated glob patterns. Reload dictionaries clears both server and browser search caches and refreshes the ordered CSV checklists; reload the browser to refresh the legacy single-file dropdown options after adding/removing CSVs. Active IME composition, stale input, Escape and node removal cannot commit obsolete suggestions. Chromium uses native edits for undo; fallback editing on other browsers may not preserve native undo history.
Developer checks (no additional dependencies):
python -B tests/test_backend.py
node --test tests/test_completion_core.mjs tests/test_autocomplete.mjs
Tag file:
tag,category,count
1girl,0,4974288
long_hair,0,3608339
Translation file:
tag,ja,aliases
1girl,"少女,女の子,おんなのこ","少女,女の子,若い女性,girl"
long_hair,"長髪,ロングヘア","長髪,ロングヘア,髪が長い"
Tag file (priority) behavior
Selecting a specific CSV does not restrict search to that file alone. Matches from the selected CSV are assigned priority 0 and fallback matches priority 1, and this priority is evaluated before the selected Sort mode.
For example, with Suggestion count = 20, if the selected CSV has only 7 matches for the query, those 7 appear first and up to 13 additional matches are filled from other sources enabled by Tag source. If the selected CSV has 20 or more matches, only its matches will normally be visible within that result limit.
Settings
Tag selection modeandTranslation selection mode: independently choose the existingAll / single priority(All / single filefor translations) orSelected CSVs only. The default preserves existing settings.Selected tag CSVs (ordered)andSelected translation CSVs (ordered): check files in priority order, then use ↑ / ↓ to reorder. In selected mode only checked files are read. The first selected tag CSV wins duplicate rows and its matches precede later files beforeSort mode; the first selected translation CSV wins duplicate translations. Empty tag selection gives no suggestions; empty translation selection gives no translations. Missing selections remain visible as unavailable and never fall back to All.- In selected mode the tag checklist controls search instead of
Tag sourceandTag file (priority), and the translation checklist controls search instead ofTranslation file. The legacy controls remain visible but are not used in the corresponding selected mode. Switching back restores those existing choices. Settings are global and do not add workflow fields. Restart ComfyUI and reload the browser after updating to enable the new backend behavior. Tag file (priority): one file intags/tag_files/orAll. The default isAll. Selecting a file prioritizes matches from that file, then fills remaining suggestions from other files enabled byTag source.Translation file: one file intags/translation_files/orAll.Update Danbooru CSV from Hugging Face: checks and updatesdanbooru_tags.csv.List every match: shows a larger result list, capped at 500 suggestions.Suggestion count: limits displayed suggestions whenList every matchis off.Sort mode:Match first,Priority / count, orTag A-Z.Popup color: changes the suggestion popup color.Use spaces for underscores: insertslong hairinstead oflong_hair.Append comma: adds a comma after inserted suggestions.Preserve prompt formatting: enabled by default. Keeps existing line breaks, blank lines, indentation, and surrounding spaces when inserting a suggestion. Disable it to use the legacy whitespace-normalizing behavior.
Autocomplete searches are debounced by 80 ms, keyboard navigation no longer rebuilds the full suggestion list, and the Hugging Face CSV refresh check runs without blocking extension UI initialization.
Notes
-
If suggestions overlap or dragging the suggestion scrollbar dismisses JP Assist, disable
Text AutocompleteunderSettings → pysssss. That separate extension provides Embedding/LoRA suggestions; JP Assist does not automatically fetch those model lists. -
Autocomplete is attached to multiline text areas owned by ComfyUI nodes, not general Settings or modal text areas.
-
The GitHub repository does not include
danbooru_tags.csv. -
The downloaded
danbooru_tags.csvkeeps the original filename and original content. -
Hugging Face updates are streamed into a temporary file and the CSV header is validated before replacement.
-
Automatically downloaded CSV files are limited to 128 MiB.
-
User tag files should be placed under
tags/tag_files/. -
Japanese translation or alias files should be placed under
tags/translation_files/. -
Large
Allcombinations may take longer on the first search than choosing a single CSV. -
If no tag file is available, no suggestion popup is shown.
License
The source code is released under the MIT License.
Bundled tag and translation data may include modified third-party data. See THIRD_PARTY_NOTICES.md for source attribution and usage terms.