ComfyUI > Nodes > comfyui-adaptiveprompts > Prompt Context Merge

ComfyUI Node: Prompt Context Merge

Class Name

PromptContextMerge

Category
adaptiveprompts/context
Author
Alectriciti (Account age: 5005days)
Extension
comfyui-adaptiveprompts
Latest Updated
2025-11-05
Github Stars
0.05K

How to Install comfyui-adaptiveprompts

Install this extension via the ComfyUI Manager by searching for comfyui-adaptiveprompts
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter comfyui-adaptiveprompts in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Prompt Context Merge Description

Merge multiple contexts into cohesive dictionary for prompt generation, preserving data integrity and handling various input shapes efficiently.

Prompt Context Merge:

The PromptContextMerge node is designed to seamlessly integrate multiple contexts into a single, cohesive context that can be effectively utilized by other components such as PromptGeneratorAdvanced or resolve_wildcards. This node is particularly beneficial when you have multiple sources of contextual information that need to be combined without losing any data. It ensures that if the same variable appears in multiple contexts, their values are appended rather than overwritten, preserving all relevant information. The node is capable of handling various input shapes, including dictionaries of dictionaries, lists of values, and single values. It also maintains the origin keys from incoming dictionaries, creating unique suffixes when necessary to avoid key collisions. The result is a well-structured dictionary that maps variable names to their respective origin keys and values, making it an essential tool for managing complex prompt generation scenarios.

Prompt Context Merge Input Parameters:

context_a

context_a is an optional input parameter that accepts a dictionary structure. It represents one of the contexts to be merged. This parameter allows you to input a set of variables and their associated values, which will be combined with other contexts provided. There are no specific minimum or maximum values, as it depends on the complexity and size of your context data.

context_b

Similar to context_a, context_b is another optional input parameter that accepts a dictionary. It serves as an additional context source to be merged. This parameter is useful when you have multiple contexts that need to be integrated into a single output. Like context_a, it does not have predefined limits on its values.

context_c

context_c is the third optional input parameter, also accepting a dictionary. It provides yet another context to be merged with context_a and context_b. This parameter is particularly useful when dealing with complex scenarios where multiple contexts need to be unified. As with the other context parameters, there are no specific constraints on its values.

Prompt Context Merge Output Parameters:

DICT

The output of the PromptContextMerge node is a dictionary (DICT) that represents the combined context. This dictionary maps variable names to another dictionary that contains origin keys and their corresponding values. The output is structured to ensure that all input contexts are represented without data loss, making it a crucial component for subsequent prompt generation processes. The merged context is ready to be fed into other nodes that require a comprehensive set of contextual information.

Prompt Context Merge Usage Tips:

  • To effectively use the PromptContextMerge node, ensure that your input contexts (context_a, context_b, context_c) are well-structured and contain relevant variables and values that need to be combined.
  • When dealing with potential key collisions, rely on the node's ability to create unique suffixes to preserve all data, ensuring that no information is lost during the merge process.

Prompt Context Merge Common Errors and Solutions:

KeyError: 'variable_name'

  • Explanation: This error occurs when a variable name expected in the context is missing or not properly defined in any of the input contexts.
  • Solution: Verify that all necessary variables are included in at least one of the input contexts (context_a, context_b, context_c). Ensure that the variable names are correctly spelled and match the expected format.

TypeError: 'NoneType' object is not iterable

  • Explanation: This error can happen if one of the input contexts is None or not properly initialized as a dictionary.
  • Solution: Ensure that all input contexts are initialized as dictionaries, even if they are empty. Check that the inputs are correctly passed to the node and are not None.

Prompt Context Merge Related Nodes

Go back to the extension to check out more related nodes.
comfyui-adaptiveprompts
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.