ComfyUI > Nodes > comfyUI-tool-2lab > Switch Prompt (2lab)

ComfyUI Node: Switch Prompt (2lab)

Class Name

SwitchPrompt (2lab)

Category
🦊2lab/pack
Author
AI2lab (Account age: 222days)
Extension
comfyUI-tool-2lab
Latest Updated
2024-07-18
Github Stars
0.01K

How to Install comfyUI-tool-2lab

Install this extension via the ComfyUI Manager by searching for comfyUI-tool-2lab
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter comfyUI-tool-2lab 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
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Switch Prompt (2lab) Description

Automate prompt selection for AI artists, switch between text prompts based on line number, streamline workflow efficiency.

SwitchPrompt (2lab):

The SwitchPrompt node is designed to streamline the process of selecting and switching between different text prompts within a workflow. This node is particularly useful for AI artists who need to manage multiple prompts efficiently, allowing them to dynamically choose a specific prompt based on a given line number. By automating the selection process, SwitchPrompt helps in maintaining a smooth workflow, reducing manual intervention, and ensuring that the correct prompt is used at the right time. This can be especially beneficial in complex projects where multiple prompts are used to generate varied outputs.

SwitchPrompt (2lab) Input Parameters:

line

The line parameter specifies the line number of the prompt you want to select from the provided list of prompts. It is a string that represents an integer value, with the default being '1'. This parameter is crucial as it determines which prompt will be chosen from the list. The value should be a positive integer, and it is important to ensure that it corresponds to a valid line number within the provided prompts.

prompts

The prompts parameter is a string containing multiple prompts separated by newline characters. Each line represents a different prompt that can be selected based on the line parameter. This parameter allows you to input a list of prompts in a single string, making it easier to manage and switch between them. The prompts should be formatted correctly, with each prompt on a new line to ensure accurate selection.

SwitchPrompt (2lab) Output Parameters:

prompt

The prompt output parameter returns the selected prompt based on the specified line number. This output is a string that contains the exact text of the chosen prompt. It is essential for ensuring that the correct prompt is used in subsequent nodes or processes within the workflow. The output helps in maintaining consistency and accuracy in the generated results.

SwitchPrompt (2lab) Usage Tips:

  • Ensure that the line parameter corresponds to a valid line number within the prompts string to avoid errors.
  • Format the prompts string correctly, with each prompt on a new line, to ensure accurate selection.
  • Use this node to manage and switch between multiple prompts efficiently, especially in complex workflows with varied outputs.

SwitchPrompt (2lab) Common Errors and Solutions:

ValueError: list index out of range

  • Explanation: This error occurs when the specified line number exceeds the number of available prompts in the prompts string.
  • Solution: Ensure that the line parameter is within the range of the number of prompts provided. Check the total number of prompts and adjust the line parameter accordingly.

ValueError: invalid literal for int() with base 10

  • Explanation: This error occurs when the line parameter cannot be converted to an integer, possibly due to non-numeric characters.
  • Solution: Verify that the line parameter is a valid string representation of an integer. Ensure that it contains only numeric characters and no spaces or special characters.

ValueError: empty prompt list

  • Explanation: This error occurs when the prompts string is empty or does not contain any valid prompts.
  • Solution: Provide a valid prompts string with at least one prompt. Ensure that each prompt is on a new line and the string is not empty.

Switch Prompt (2lab) Related Nodes

Go back to the extension to check out more related nodes.
comfyUI-tool-2lab
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.