🍒Prompt_Loader📝提示词加载器:
The Prompt_Loader node is designed to streamline the process of loading and managing text prompts from files, making it an invaluable tool for AI artists who work with large sets of textual data. This node allows you to specify a directory containing text files, from which it will load prompts in a flexible and efficient manner. It supports both sequential and non-sequential loading modes, enabling you to either process files in a specific order or randomly. The node also provides options to control the starting point and the number of prompts to load, offering a high degree of customization. By leveraging features like natural sorting and seed-based indexing, Prompt_Loader ensures that you can manage your prompt files with precision and ease, enhancing your workflow and creativity.
🍒Prompt_Loader📝提示词加载器 Input Parameters:
prompt_dir
This parameter specifies the directory path where your prompt files are located. It is a required field and expects a string input. The directory should contain text files with prompts that you wish to load. If the directory does not exist, the node will not function correctly. This parameter does not have a default value, as it is essential for the node's operation.
sequential_mode
This boolean parameter determines whether the prompts should be loaded in a sequential order. When set to True, the node will process files one by one in the order they appear. If set to False, the node will apply the load_cap to determine how many prompts to load. The default value is False, allowing for more flexible loading by default.
reset_to_first
This boolean parameter controls whether the loading process should reset to the starting position. When enabled (True), the node will begin loading from the start_index each time. If disabled (False), it will continue from the current position. The default setting is False, which is useful for continuous processing without resetting.
start_index
This integer parameter sets the starting point for loading prompts. It accepts values from -1 to a very large positive number. A value of -1 indicates starting from the last prompt, while 0 or greater specifies the exact index to begin from. The default value is 0, which starts loading from the first prompt.
load_cap
This integer parameter defines the number of prompts to load at a time. A value of 0 means all prompts will be loaded, while any positive integer specifies the exact number of prompts to load. The default value is 0, allowing for complete loading unless specified otherwise.
seed
This integer parameter is used to control the randomness of the loading process, particularly in non-sequential mode. It helps in determining the starting index when not resetting to the first position. The default value is 666, and it can range from 0 to a very large positive number.
reload
This optional boolean parameter dictates when the node should reload the prompts. If set to True, the node will reload if the file has changed. If False, it will reload only if the parameter values have changed. The default is False, focusing on parameter changes.
🍒Prompt_Loader📝提示词加载器 Output Parameters:
prompt_list
This output provides a list of loaded prompts as strings. It reflects the prompts extracted from the text files in the specified directory, based on the input parameters. This list is crucial for further processing or use in AI models.
file_names
This output returns a list of file names corresponding to the loaded prompts. The names are stripped of their paths and extensions, providing a clean reference to the source files. This is useful for tracking which files contributed to the loaded prompts.
current_index
This integer output indicates the current index position in the list of prompt files. It helps in understanding the progress of the loading process and is particularly useful when working in sequential mode.
🍒Prompt_Loader📝提示词加载器 Usage Tips:
- Ensure that the
prompt_diris correctly set to a valid directory containing your text files to avoid errors. - Use
sequential_modewhen you need to process files in a specific order, such as when the sequence of prompts is important for your project. - Adjust the
start_indexandload_capto manage large datasets effectively, allowing you to load only the necessary prompts for your current task. - Utilize the
seedparameter to maintain consistency in loading order across different sessions, especially when not using sequential mode.
🍒Prompt_Loader📝提示词加载器 Common Errors and Solutions:
Directory does not exist
- Explanation: This error occurs when the specified
prompt_dirdoes not point to a valid directory. - Solution: Verify that the directory path is correct and that it exists on your file system.
Error processing file
- Explanation: This error indicates an issue with reading a file, possibly due to unsupported encoding.
- Solution: Ensure that all text files in the directory are encoded in UTF-8, as this is the supported format for the node.
No prompt files found
- Explanation: This error arises when no text files are found in the specified directory.
- Solution: Check that the directory contains
.txtfiles and that the path is correctly specified.
