示例#1
0
def _rasa_service(
    args: argparse.Namespace,
    endpoints: AvailableEndpoints,
    rasa_x_url: Optional[Text] = None,
    credentials_path: Optional[Text] = None,
):
    """Starts the Rasa application."""
    from rasa.core.run import serve_application
    import rasa.utils.common

    # needs separate logging configuration as it is started in its own process
    rasa.utils.common.set_log_level(args.loglevel)
    io_utils.configure_colored_logging(args.loglevel)

    if not credentials_path:
        credentials_path = _prepare_credentials_for_rasa_x(
            args.credentials, rasa_x_url=rasa_x_url)

    serve_application(
        endpoints=endpoints,
        port=args.port,
        credentials=credentials_path,
        cors=args.cors,
        auth_token=args.auth_token,
        enable_api=True,
        jwt_secret=args.jwt_secret,
        jwt_method=args.jwt_method,
        ssl_certificate=args.ssl_certificate,
        ssl_keyfile=args.ssl_keyfile,
        ssl_ca_file=args.ssl_ca_file,
        ssl_password=args.ssl_password,
    )
示例#2
0
def _core_service(args: argparse.Namespace,
                  endpoints: "AvailableEndpoints" = None):
    """Starts the Rasa Core application."""
    from rasa.core.run import serve_application
    from rasa.nlu.utils import configure_colored_logging

    configure_colored_logging(args.loglevel)
    logging.getLogger("apscheduler.executors.default").setLevel(
        logging.WARNING)

    args.credentials = get_validated_path(args.credentials, "credentials",
                                          DEFAULT_CREDENTIALS_PATH, True)

    if endpoints is None:
        args.endpoints = get_validated_path(args.endpoints, "endpoints",
                                            DEFAULT_ENDPOINTS_PATH, True)
        from rasa.core.utils import AvailableEndpoints

        endpoints = AvailableEndpoints.read_endpoints(args.endpoints)

    serve_application(
        endpoints=endpoints,
        port=args.port,
        credentials=args.credentials,
        cors=args.cors,
        auth_token=args.auth_token,
        enable_api=True,
        jwt_secret=args.jwt_secret,
        jwt_method=args.jwt_method,
    )
示例#3
0
def _rasa_service(
    args: argparse.Namespace,
    endpoints: "AvailableEndpoints",
    rasa_x_url: Optional[Text] = None,
):
    """Starts the Rasa application."""
    from rasa.core.run import serve_application

    # needs separate logging configuration as it is started in its own process
    logging.basicConfig(level=args.loglevel)
    io_utils.configure_colored_logging(args.loglevel)
    logging.getLogger("apscheduler").setLevel(logging.WARNING)

    credentials_path = _prepare_credentials_for_rasa_x(args.credentials,
                                                       rasa_x_url=rasa_x_url)

    serve_application(
        endpoints=endpoints,
        port=args.port,
        credentials=credentials_path,
        cors=args.cors,
        auth_token=args.auth_token,
        enable_api=True,
        jwt_secret=args.jwt_secret,
        jwt_method=args.jwt_method,
    )
示例#4
0
文件: up.py 项目: lsx0930/rasa_usage
def start_core(platform_token):
    from rasa.core.utils import AvailableEndpoints
    from rasa.core.run import serve_application
    from rasa.core.utils import EndpointConfig

    _endpoints = AvailableEndpoints(
        # TODO: make endpoints more configurable, esp ports
        model=EndpointConfig(
            "http://localhost:5002"
            "/api/projects/default/models/tags/production",
            token=platform_token,
            wait_time_between_pulls=1),
        event_broker=EndpointConfig(**{"type": "file"}),
        nlg=EndpointConfig("http://localhost:5002"
                           "/api/nlg",
                           token=platform_token))

    serve_application(
        "models",
        nlu_model=None,
        channel="rasa",
        credentials_file="credentials.yml",
        cors="*",
        auth_token=None,  # TODO: configure auth token
        enable_api=True,
        endpoints=_endpoints)
示例#5
0
def start_slack_connector() -> None:
    serve_application(
        model_path=DEFAULT_MODELS_PATH,
        channel="slack",
        port="5004",
        credentials="credentials.yml",
    )
示例#6
0
文件: x.py 项目: whitewolfkings/rasa
def _rasa_service(args: argparse.Namespace,
                  endpoints: "AvailableEndpoints",
                  rasa_x_url=None):
    """Starts the Rasa application."""
    from rasa.core.run import serve_application
    from rasa.nlu.utils import configure_colored_logging

    configure_colored_logging(args.loglevel)
    logging.getLogger("apscheduler.executors.default").setLevel(
        logging.WARNING)

    credentials_path = _prepare_credentials_for_rasa_x(args.credentials,
                                                       rasa_x_url=rasa_x_url)

    serve_application(
        endpoints=endpoints,
        port=args.port,
        credentials=credentials_path,
        cors=args.cors,
        auth_token=args.auth_token,
        enable_api=True,
        jwt_secret=args.jwt_secret,
        jwt_method=args.jwt_method,
    )