diff options
Diffstat (limited to '__main__.py')
-rw-r--r-- | __main__.py | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/__main__.py b/__main__.py index 797ec56..6692d7e 100644 --- a/__main__.py +++ b/__main__.py @@ -8,6 +8,7 @@ from .modules.config import load_config from .modules.hassil.recognize import recognize from .modules.hassil.util import merge_dict from .modules.hassil.intents import Intents, TextSlotList +from modules.responses.responses import Responses from .modules.input_handlers.stdin_input import StdinInput from .modules.input_handlers.pipewire_record import PipeWireRecord @@ -19,9 +20,22 @@ def main(): config = load_config() input_dict = {"intents": {}} - yaml_path = Path(config.intents_dir) - yaml_file_paths = yaml_path.glob("*.yaml") + intent_yaml_path = Path(config.intents_dir) + intent_yaml_file_paths = intent_yaml_path.glob("*.yaml") + for yaml_file_path in intent_yaml_file_paths: + with open(yaml_file_path, "r", encoding="utf-8") as yaml_file: + merge_dict(input_dict, yaml.safe_load(yaml_file)) + + intents = Intents.from_dict(input_dict) + + response_yaml_path = Path(config.responses_dir) + response_yaml_file_paths = response_yaml_path.glob("*.yaml") + for yaml_file_path in response_yaml_file_paths: + with open(yaml_file_path, "r", encoding="utf-8") as yaml_file: + merge_dict(input_dict, yaml.safe_load(yaml_file)) + responses = Responses.from_dict(input_dict) + processes = [] for file in os.listdir(config.applications_dir): if file == "[": @@ -35,12 +49,6 @@ def main(): "process": TextSlotList.from_strings(processes) } - for yaml_file_path in yaml_file_paths: - with open(yaml_file_path, "r", encoding="utf-8") as yaml_file: - merge_dict(input_dict, yaml.safe_load(yaml_file)) - - intents = Intents.from_dict(input_dict) - input_handler = PipeWireRecord() if config.input_handler == Config.INPUT_PW else StdinInput() try: |