def _write_domain_to_file( domain_path: Text, evts: List[Dict[Text, Any]], endpoint: EndpointConfig ) -> None: """Write an updated domain file to the file path.""" domain = retrieve_domain(endpoint) old_domain = Domain.from_dict(domain) messages = _collect_messages(evts) actions = _collect_actions(evts) # TODO for now there is no way to distinguish between action and form intent_properties = Domain.collect_intent_properties( _intents_from_messages(messages)) collected_actions = list({e["name"] for e in actions if e["name"] not in default_action_names()}) new_domain = Domain( intent_properties=intent_properties, entities=_entities_from_messages(messages), slots=[], templates={}, action_names=collected_actions, form_names=[]) old_domain.merge(new_domain).persist_clean(domain_path)
def _write_domain_to_file(domain_path: Text, evts: List[Dict[Text, Any]], endpoint: EndpointConfig) -> None: """Write an updated domain file to the file path.""" domain = retrieve_domain(endpoint) old_domain = Domain.from_dict(domain) messages = _collect_messages(evts) actions = _collect_actions(evts) domain_dict = dict.fromkeys(domain.keys(), []) # TODO for now there is no way to distinguish between action and form domain_dict["forms"] = [] domain_dict["intents"] = _intents_from_messages(messages) domain_dict["entities"] = _entities_from_messages(messages) # do not automatically add default actions to the domain dict domain_dict["actions"] = list({ e["name"] for e in actions if e["name"] not in default_action_names() }) new_domain = Domain.from_dict(domain_dict) old_domain.merge(new_domain).persist_clean(domain_path)