Chelsea / command /utils /build_chain.py
CineAI's picture
v0.0.1_DigItBMTH
d5436e0
raw
history blame
687 Bytes
from ..basic.documentation import DocumentationHandler
from ..utils.read_yaml import load_commands_from_yaml
def build_command_chain():
commands = load_commands_from_yaml(file_path="../commands.yaml")
handlers = None
for cmd_data in commands:
command_dict = cmd_data.get('command_dict', {})
commands_list = [cmd.lower() for cmds in command_dict.values() for cmd in cmds]
description = cmd_data.get('description', '')
if description.lower() == "download text file with all commands":
handler = DocumentationHandler(commands_list, handlers)
else:
handler = None
handlers = handler
return handlers