def run(core_dir, nlu_dir, endpoints_file): configs = { 'user': os.getenv('ROCKETCHAT_BOT_USERNAME'), 'password': os.getenv('ROCKETCHAT_BOT_PASSWORD'), 'server_url': os.getenv('ROCKETCHAT_URL'), } input_channel = RocketChatInput(user=configs['user'], password=configs['password'], server_url=configs['server_url']) _endpoints = AvailableEndpoints.read_endpoints(endpoints_file) _interpreter = NaturalLanguageInterpreter.create(nlu_dir, _endpoints.nlu) _tracker_store = ElasticTrackerStore() _agent = load_agent(core_dir, interpreter=_interpreter, tracker_store=_tracker_store, endpoints=_endpoints) http_server = start_server([input_channel], "", "", 5005, _agent) try: http_server.serve_forever() except Exception as exc: logger.exception(exc)
def run(core_dir, nlu_dir): pika_broker = None if ENABLE_ANALYTICS: pika_broker = PikaProducer(url, username, password, queue=queue) configs = { 'user': os.getenv('ROCKETCHAT_BOT_USERNAME'), 'password': os.getenv('ROCKETCHAT_BOT_PASSWORD'), 'server_url': os.getenv('ROCKETCHAT_URL'), } input_channel = RocketChatInput(user=configs['user'], password=configs['password'], server_url=configs['server_url']) _tracker_store = InMemoryTrackerStore(domain=None, event_broker=pika_broker) _endpoints = AvailableEndpoints.read_endpoints(None) _interpreter = NaturalLanguageInterpreter.create(nlu_dir) _agent = load_agent(core_dir, interpreter=_interpreter, tracker_store=_tracker_store, endpoints=_endpoints) http_server = start_server([input_channel], "", "", 5005, _agent) try: http_server.serve_forever() except Exception as exc: logger.exception(exc)
def run(core_dir, nlu_dir): configs = { 'user': os.getenv('ROCKETCHAT_BOT_USERNAME'), 'password': os.getenv('ROCKETCHAT_BOT_PASSWORD'), 'server_url': os.getenv('ROCKETCHAT_URL'), } input_channel = RocketChatInput( user=configs['user'], password=configs['password'], server_url=configs['server_url'] ) _endpoints = AvailableEndpoints.read_endpoints(None) _interpreter = NaturalLanguageInterpreter.create(nlu_dir) elastic_user = os.getenv('ELASTICSEARCH_USER') if elastic_user is None: _tracker_store = ElasticTrackerStore( domain = os.getenv('ELASTICSEARCH_URL', 'elasticsearch:9200') ) else: _tracker_store = ElasticTrackerStore( domain = os.getenv('ELASTICSEARCH_URL', 'elasticsearch:9200'), user = os.getenv('ELASTICSEARCH_USER', 'user'), password = os.getenv('ELASTICSEARCH_PASSWORD', 'password'), scheme = os.getenv('ELASTICSEARCH_HTTP_SCHEME', 'http'), scheme_port = os.getenv('ELASTICSEARCH_PORT', '80') ) _agent = load_agent(core_dir, interpreter=_interpreter, tracker_store=_tracker_store, endpoints=_endpoints) http_server = start_server([input_channel], "", "", 5005, _agent) try: http_server.serve_forever() except Exception as exc: logger.exception(exc)