tags - altoiddealer/ad_discordbot GitHub Wiki

The 'tags' feature is a versatile method to tailor the bot's behavior for your use case.

Tags may be defined in dict_tags.yaml for global effect, as well as in character cards and imgmodel definitions.

Notes:

  • 'trigger' key is recommended for most tags (except 'global_tag_keys' and 'tag_preset_name').
  • Multiple comma-separated trigger phrases can be used per each tag (trigger: 'a boy,a dog' can match either 'a boy' or 'a dog')
  • You may simplify triggers using this syntax: 'a {boy|dog}' --- the script will read this as 'a boy,a dog'
  • You may use multiple trigger keys in a tag definition such as 'trigger1', 'trigger2' - in which case, a trigger phrase must match the search text from each one
  • The behavior of tags listed higher may override ones listed lower. Sources are also prioritized: character > imgmodel > base_tags
  • Valid tag keys are detailed at the end of this file and on GitHub

Flow Chart Overview of the Tags System:

CLICK TO EXPAND

tags-system


Tags from Text:

You can create/activate one time use Tags on-the-fly by using the syntax [[ key1 : value1 | key2 : value2 | etc... ]] or [[ key: value ]]

EXPAND FOR SCREENSHOT Screenshot 2024-05-05 090439
  • Very flexible with syntax:
    • keys / values can be wrapped in 'quotes' or "double quotes" or neither, it does not matter
    • White space can be included or not, it does not matter
  • The matched syntax is removed from your text
  • These tags are immediately activated
  • Works for ANY tag value, including strings (text), booleans (True/False), {Dictionaries}, [Lists], and even [[sub][lists]]

Conditional Tags

tag name value type description default
search_mode string Search method for trigger matching. 'user' = user prompt only / 'llm' = bot reply only / 'userllm' = search both for matches userllm
trigger string Recommended for most tags (except 'global_tag_keys' and 'tag_preset_name'). None
Additional triggers (trigger1, trigger2, etc) string if using multiple trigger keys, a trigger phrase must match the search text from each one. The key names just need to start with 'trigger' and be unique, the order is unimportant None
only_with_tags [list of strings] A list of tag names (see name param). This condition will be True if any named tag was matched. (ex, only_with_tags: ['imgmodel', 'another tag name']) None
random float Chance for tag to process. 0.0 = 0% chance and 1.0 = 100% chance. 1.0
case_sensitive True/False If the triggers are case sensitive False
on_prefix_only True/False If triggers must be matched at beginning of the searched text False
To access the "id" needed for the following conditions, you must enable Developer Mode (warning: Ads) for your account (Account Settings > Advanced > Developer Mode). These can be either one id, example: int / or a comma separated list, example: [int, int, int]
for_guild_ids_only int Value is a 'server_id' number. Get this by right-clicking a Server and selecting "Copy Server ID". None
for_channel_ids_only int Value is a 'channel_id' number. Get this by right-clicking a channel (or DM) and selecting "Copy Channel ID" None
persist int Tags matched with persist will automatically re-apply for that many future requests, in the same channel, during the same "match phase", before the tag is checked normally again. Ignores triggers, but NOT random. persist: -1 will make triggered tag persist forever. None

Tags Relevant to both LLM/Img gen:

tag name value type description default
name string Used in print statements and some tag interactions. Required when using a 'persist' tag. None
send_user_image string Sends a local image to the channel. Value values: Image in '/user_images/' (png/jpg/txt in base64) -OR- Directory name in '/user_images/' (picks random img) None
call_api dictionary Refer to 'dict_api_settings.yaml'. Required: {endpoint_name: The Endpoint Name}. Recommended to include: {api_type: (imggen/ttsgen/textgen)} for 'main' APIs, or {api_name: The Client Name} for all others. Any endpoint params can be overridden in this dict. Payload can be updated with {input_data: {key: value, ...}}. None
run_workflow dictionary Refer to 'dict_api_settings.yaml'. Runs a predefined workflow. Valid usage: {name: Name of the Workflow, (optional)input_data: {key1: value1, key2: value2, etc}}. For 'call_api' and 'run_workflow': Any string values can contain bot formtting syntax, ex: "{prompt}" will be replaced with the actual user's text. None
flow dictionary A dict of 'flow_steps'. When a 'flow' tag is triggered, it creates a message loop for each defined 'loop_step' None
flow_step list The tags you want to apply in each flow step. Without a trigger, they will auto-apply. 'format_prompt' is very useful in each flow_step None
flow_step_loops integer The number of times you want to loop a particular flow_step. 0

Text Generation Tags

Relevant to text generation (LLM):

tag name value type description default
should_gen_text True/False If LLM should generate text. If False and 'should_gen_image' is True, passes the user's text as prompt for image gen. True
should_send_text True/False If LLM should send generated text to channel. Mainly used for 'flows' tag. True
llm_censoring True/False True = blocks text from being generated False
begin_reply_with string The LLM will continue their reply from this. None
change_llmmodel string For (change/swap)_llmmodel: 'change' will trigger a persistent change. 'swap' will only change the LLM model for the current interaction. None
swap_llmmodel string Name of an LLM model (ei: 'Mistral-7B-OpenOrca-GPTQ'). Value 'None' will unload the LLM model! None
time_offset integer/float 0 = today's date (system time). -0.5 shifts the current date to be 12 hours ago. (UOM = days) 0.0
time_format string Examples: '%H:%M:%S' (HH:MM:SS), '%I:%M:%S %p' (12HR:MM:SS AM/PM) '%H:%M:%S'
date_format string Examples: '%Y-%m-%d' (YYYY-MM-DD), '%A, %B %d, %Y' (DayName, MonthName DD, YYYY) '%Y-%m-%d'
format_prompt string Useful for adding text before and/or after your prompt to the LLM. If you do not include {prompt}, your prompt will be replaced entirely with the value of 'format_prompt'. Can include any variables, see '/tips_and_info/Message Variables.txt' None
insert_text string Text you may want to insert relative to the matched search text. ''
insert_text_method string Relevant in tags with key 'insert_text'. 'after' = insert value after matched text / 'before' = before text / 'replace' = replace text after
text_joining string Relevant to all insertion methods except "replace" ' '
change_character string Filename of character in /characters (do not include extension). That character's name, context, and state parameters will be used in LLM payload. None
swap_character string For (change/swap)_character: 'change' will trigger a persistent change. 'swap' will only change the character for the current interaction. None
filter_history_for string Applies before other "history" tags. Filters the history based on the name of a user or a (character/swap character). Includes the user/assistant exchange for matched items. None
load_history integer 0 = default (all history included) / -1 = prompt excludes chat history / > 1 = llm only sees this many recent exchanges. 0
save_history True/False Whether to save this interaction to history or not. True
include_hidden_history true/false If true, the history for this interaction will include ones previously hidden via 'save_history' tag, or toggled off via 'toggle as hidden' App Command False
state {dictionary} Update values for textgen-webui state parameters. Must be formatted as a dictionary. None
prefix_context string Inserts text immediately before the 'context', joined by \n (new line). Multiple can accumulate. None
suffix_context string Inserts text immediately after the 'context', joined by \n (new line). Multiple can accumulate. None
llm_param_variances {dictionary} Randomization ranges for textgen-webui state parameters. Must be formatted as a dictionary. None

Image Generation Tags

Relevant to Img generation:

tag name value type description default
sd_output_dir string Location to save any generated images. 'ad_discordbot/sd_outputs/'
should_gen_image True/False If bot should generate an image using Stable Diffusion. The LLM's reply will be used as the img prompt, unless no LLM Model is loaded or 'should_gen_text' is False - in which case user message is prompt. False
should_send_image True/False If bot should send generated image to channel. Mainly used for 'flows' tag. False
change_imgmodel string For (change/swap)_imgmodel: 'change' will trigger a persistent change. 'swap' will only change the Img model for the current interaction None
swap_imgmodel string A valid model name/value ''
img_censoring integer 0 = disabled / 1 = blur image / 2 = block image from being generated 0
positive_prompt string Text you may want to insert relative to the matched text in the image prompt. None
positive_prompt_method string Relevant to 'positive_prompt'. 'after' = insert value after matched text / 'before' = before text / 'replace' = replace text after
positive_prompt_prefix string Insert text at the beginning of the image positive prompt None
positive_prompt_suffix string Insert text at the end of the image positive prompt None
negative_prompt_prefix string Insert text at the beginning of the image negative prompt None
negative_prompt string Insert text at the end of the image negative prompt ('_suffix' also works) None
img_text_joining string Relevant to all insertion methods except "replace" ', '
payload {dictionary} Replacements for active payload. Must be formatted as a dictionary. None
aspect_ratio string This a shortcut to dynamically set the payload width/height dimensions based on the current average dimensions. Valid values examples: '4:3', '16:9', '2:3', etc None
img_param_variances {dictionary} Randomization ranges for active payload parameters. Must be formatted as a dictionary. None
img2img string Uses a local image as img2img input. Value values: Image in 'user_images' (png/jpg/txt in base64) -OR- Directory name in '/user_images/' (Picks a random image or random image from random subdirectory) ''
img2img_mask string AKA Inpainting. Won't have any effect without img2img also triggered. Should be a greyscale image. Value values: Image in 'user_images' (png/jpg/txt in base64) -OR- Directory name in '/user_images/' (Picks a random image or random image from random subdirectory) ''

ControlNet specific tags

Relevant to Img generation (A1111/Forge/ReForge - not yet Supported for ComfyUI):

tag name value type description default
controlnet string Simplified tag to both apply ControlNet image/folder AND enable ControlNet. None
controlnet# string Optional syntax for multi-ControlNet where '#' represents the ControlNet unit. ex: 'controlnet0: guy.png', 'controlnet1: architecture', etc. Valid values: Image in 'user_images' (png/jpg/txt in base64) -OR- Directory name in '/user_images/' (Picks a random image or random image from random subdirectory) None
cnet_{key} string ANY key can be used (see dict_base_settings.yaml for complete list). A 'controlnet' tag must also be in effect when using these tags in order to properly assign the image. None
cnet#_{key} string Optional syntax for multi-ControlNet parameters where '#' represents the ControlNet unit. ex: 'cnet0_weight: 0.5', 'cnet1_guidance_end: 0.8', etc. None
cnet#_mask_image string The value for the 'cnet_mask_image' param will be handled exactly the same as the main controlnet (see writeup for 'controlnet' a few lines up) None

Forge Couple specific tags

Relevant to Img generation (Forge ONLY):

tag name value type description default
forgecouple string OR [list] Simplified tag to both apply AND enable Forge Couple. For Basic mode, use string: 'Horizontal' / 'Vertical'. For Advanced mode, use a list of lists (refer to dict_base_settings.yaml) None
couple_{key} ANY key can be used (see dict_base_settings.yaml for complete list). Note: Forge Couple will not be enabled without a 'forgecouple' tag. None

layerdiffuse specific tags

Relevant to Img generation (Forge ONLY):

tag name value type description default
layerdiffuse string Simplified tag to both apply AND enable layerdiffuse. Note: 'laydiff_method' works exactly the same. None
laydiff_method string Valid values for either 'layerdiffuse' or 'laydiff_method':
"(SD1.5) Only Generate Transparent Image (Attention Injection)"
"(SD1.5) From Foreground to Background (need batch size 2)"
"(SD1.5) From Background to Foreground (need batch size 2)"
"(SD1.5) Generate Everything Together (need batch size 3)"
"(SDXL) Only Generate Transparent Image (Attention Injection)"
"(SDXL) Only Generate Transparent Image (Conv Injection)"
"(SDXL) From Foreground to Blending"
"(SDXL) From Foreground and Blending to Background"
"(SDXL) From Background to Blending"
"(SDXL) From Background and Blending to Foreground"
None
laydiff_{key} string ANY key can be used (see dict_base_settings.yaml for complete list). Note: layerdiffusion will not be enabled without either a 'layerdiffuse' or 'laydiff_method' tag. None

ReActor specific tags

Relevant to Img generation (A1111/Forge/ReForge - not yet Supported for ComfyUI):

tag name value type description default
reactor string Simplified tag to both apply face image/folder/model AND enable ReActor. Valid values: Image in 'user_images' (png/jpg/txt in base64) -OR- Directory name in '/user_images/' (Picks a random image or random image from random subdirectory) -OR- Face model in '{SD_CLIENT}\models\reactor\faces' example 'M1nty.safetensors' None
reactor_{key} string ANY key can be used (see dict_base_settings.yaml for complete list). Recommended to use in combination with 'reactor' tag - otherwise, you can't use "single face image method" (technically, you could send a base64 string... and you would need to include 'reactor_enabled: True') None
reactor_mask string Value values: Image in 'user_images' (png/jpg/txt in base64), directory, etc. Should be a greyscale image, which will mask the face swap result. None
⚠️ **GitHub.com Fallback** ⚠️