예제 #1
0
def _initialize_with_local_data(
    project_path: Text,
    data_path: Text,
    session: Session,
    rasa_port: Union[int, Text],
    config_path: Text,
) -> Tuple[Dict[Text, Any], List[Dict[Text, Any]], TrainingData]:

    settings_service = SettingsService(session)
    default_env = default_environments_config_local(rasa_port)
    settings_service.save_environments_config(COMMUNITY_PROJECT_NAME,
                                              default_env.get("environments"))

    loop = asyncio.get_event_loop()
    # inject data
    domain, story_blocks, nlu_data = loop.run_until_complete(
        rasax.community.initialise.inject_files_from_disk(
            project_path, data_path, session, config_path=config_path))

    # dump domain once
    domain_service = DomainService(session)
    domain_service.dump_domain()
    return domain, story_blocks, nlu_data
    def _dump_domain(self) -> None:
        from rasax.community.services.domain_service import DomainService

        domain_service = DomainService(self.session)
        domain_service.dump_domain()