diff options
author | Botond Hende <nettingman@gmail.com> | 2024-11-27 22:52:45 +0100 |
---|---|---|
committer | Botond Hende <nettingman@gmail.com> | 2024-11-27 22:52:45 +0100 |
commit | 744961a1538fbb0d821c5d2a332d65fd8c6b1290 (patch) | |
tree | c64cd50642aea8d91f366cad3b2811ba5d6fada9 /__main__.py | |
parent | 9a79c535edb655ca490c2b231aad2466951caf7f (diff) |
responses basic datastructure and deserialization
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: |