メインコンテンツへスキップ

(一部未解決)comfyui-propt-controlのバグと修正ファイル

    ⚠️2026/01/17 14時 コミット「71465f9」でCOUPLE()もCOUPLE MASK()も正常に動作することを確認。

    ⚠️2026/01/17 0時 まだ「COUPLE MASK()は機能するが、短縮形のCOUPLE()は機能しない」というバグが残っていた。調査中に発見した別のバグと共に報告済み。

    ⚠️2026/01/14 8時 GitHubでの不具合報告後、v2.1.2で不具合の解消を確認。本記事は記録として残しておく。

    • 📌以下はv2.1.1の時点で起きていた問題。

    久しぶりにSDXL+comfyui-rompt-controlをガッツリ使おうとしたら、2個目以降のCOUPLEが効かない事に気づいた。
    どうやら去年の12/5のコミット「66fef1f」で壊れてしまったようだ。
    私はその二つ前の「aa6b460」で正常動作を確認したが、直前の「3341e9f」でも大丈夫だと思われる。 1/2#AI画像生成

    — ヒガナヨガナ (@higana_yogana) January 13, 2026
    • この問題について、修正ファイルを用意した。

      • 実際に作業したのはほぼgemini-cliである。私は説明・指示・確認のみ。

    • 「custom_nodes\comfyui-prompt-control\prompt_control\utils.py」をバックアップしてから上書きすれば、複数のCOUPLEが正常に動作する。
      修正までの一時しのぎとしてどうぞ。

      • 本家で修正が行われた際は、このファイルを削除してgit pullすれば適用される。

    • 変更点はここだけである。これは修正前の内容。

    def split_by_function(text, func, defaults=None, require_args=True):
        """
        Splits a string by function calls, returning the text preceding the first call and a list of dictionaries with a "text" key with the prompt before the next split or until hthe end of the text.
        """
        text, functions = get_function(text, func, defaults, return_dict=True, require_args=require_args)
        chunks = []
        prev = 0
        for f in functions:
            chunks.append(text[prev : f["position"]])
            prev = f["position"]
        chunks.append(text[prev:])
        for i, f in enumerate(functions):
            f["text"] = chunks[i + 1]
        return chunks[0], functions
    • 修正後の状態はこちら。

    def split_by_function(text, func, defaults=None, require_args=True):
        """
        Splits a string by function calls, returning the text preceding the first call and a list of dictionaries with a "text" key with the prompt before the next split or until hthe end of the text.
        """
        placeholder = f"SPLIT_{func}"
        text, functions = get_function(text, func, defaults, return_dict=True, require_args=require_args, placeholder=placeholder)
        import re
    
        chunks = re.split(rf"\0{placeholder}\d+\0", text)
        for i, f in enumerate(functions):
            f["text"] = chunks[i + 1]
        return chunks[0], functions
    • 「文字が出力できるモデルが増えてきたので、""の中の部分は無視してほしい」というリクエストに応えた結果、このバグがうまれてしまったようだ。

     
     
    PCを使っていてあれこれ苦労したことの、自分用備忘録です。 日がな一日、夜がなよっぴて検索しても解決が難しいトラブルばかりなので、ニッチな内容が多めです。 同じ問題で困っている方のお役に立てれば幸いです。

    あなたへのおすすめ