Exemplo n.º 1
0
def _overwrite_endpoints_for_local_x(endpoints: AvailableEndpoints,
                                     rasa_x_token: Text, rasa_x_url: Text):
    from rasa.utils.endpoints import EndpointConfig
    import questionary

    endpoints.model = EndpointConfig(
        f"{rasa_x_url}/projects/default/models/tags/production",
        token=rasa_x_token,
        wait_time_between_pulls=2,
    )

    overwrite_existing_event_broker = False
    if endpoints.event_broker and not _is_correct_event_broker(
            endpoints.event_broker):
        cli_utils.print_error(
            "Rasa X currently only supports a SQLite event broker with path '{}' "
            "when running locally. You can deploy Rasa X with Docker "
            "(https://rasa.com/docs/rasa-x/deploy/) if you want to use "
            "other event broker configurations.".format(DEFAULT_EVENTS_DB))
        overwrite_existing_event_broker = questionary.confirm(
            "Do you want to continue with the default SQLite event broker?"
        ).ask()

        if not overwrite_existing_event_broker:
            exit(0)

    if not endpoints.tracker_store or overwrite_existing_event_broker:
        endpoints.event_broker = EndpointConfig(type="sql",
                                                db=DEFAULT_EVENTS_DB)
Exemplo n.º 2
0
def _overwrite_endpoints_for_local_x(endpoints: AvailableEndpoints,
                                     rasa_x_token: Text, rasa_x_url: Text):
    from rasa.utils.endpoints import EndpointConfig
    import questionary

    # Checking if endpoint.yml has existing url and wait time values set, if so give
    # warning we are overwriting the endpoint.yml file.
    custom_wait_time_pulls = endpoints.model.kwargs.get(
        "wait_time_between_pulls")
    custom_url = endpoints.model.url
    default_rasax_model_server_url = (
        f"{rasa_x_url}/projects/default/models/tag/production")

    if custom_url != default_rasax_model_server_url:
        warnings.warn(
            f"Ignoring url '{custom_url}' from 'endpoints.yml' and using "
            f"'{default_rasax_model_server_url}' instead.")

    endpoints.model = EndpointConfig(
        default_rasax_model_server_url,
        token=rasa_x_token,
        wait_time_between_pulls=custom_wait_time_pulls or 2,
    )

    overwrite_existing_event_broker = False
    if endpoints.event_broker and not _is_correct_event_broker(
            endpoints.event_broker):
        cli_utils.print_error(
            "Rasa X currently only supports a SQLite event broker with path '{}' "
            "when running locally. You can deploy Rasa X with Docker "
            "(https://rasa.com/docs/rasa-x/deploy/) if you want to use "
            "other event broker configurations.".format(DEFAULT_EVENTS_DB))
        overwrite_existing_event_broker = questionary.confirm(
            "Do you want to continue with the default SQLite event broker?"
        ).ask()

        if not overwrite_existing_event_broker:
            exit(0)

    if not endpoints.tracker_store or overwrite_existing_event_broker:
        endpoints.event_broker = EndpointConfig(type="sql",
                                                db=DEFAULT_EVENTS_DB)
Exemplo n.º 3
0
def _overwrite_endpoints_for_local_x(endpoints: AvailableEndpoints,
                                     rasa_x_token: Text, rasa_x_url: Text):
    endpoints.model = _get_model_endpoint(endpoints.model, rasa_x_token,
                                          rasa_x_url)
    endpoints.event_broker = _get_event_broker_endpoint(endpoints.event_broker)