def setup_server(self): """Prepare the Messenger server for handling messages""" shared_utils.print_and_log( logging.INFO, '\nYou are going to allow people on Facebook to be agents in ' 'ParlAI.\nDuring this process, Internet connection is required, ' 'and you should turn off your computer\'s auto-sleep ' 'feature.\n', should_print=True) input('Please press Enter to continue... ') shared_utils.print_and_log(logging.NOTSET, '', True) shared_utils.print_and_log(logging.INFO, 'Setting up Messenger webhook...', should_print=True) # Setup the server with a task name related to the current task task_name = '{}-{}'.format('ParlAI-Messenger', self.opt['task']) self.server_task_name = \ ''.join(e for e in task_name.lower() if e.isalnum() or e == '-') self.server_url = server_utils.setup_server(self.server_task_name) shared_utils.print_and_log(logging.INFO, 'Webhook address: {}/webhook'.format( self.server_url), should_print=True)
def setup_server(self): """Prepare the Messenger server for handling messages""" shared_utils.print_and_log( logging.INFO, '\nYou are going to allow people on Facebook to be agents in ' 'ParlAI.\nDuring this process, Internet connection is required, ' 'and you should turn off your computer\'s auto-sleep ' 'feature.\n', should_print=True ) input('Please press Enter to continue... ') shared_utils.print_and_log(logging.NOTSET, '', True) shared_utils.print_and_log(logging.INFO, 'Setting up Messenger webhook...', should_print=True) # Setup the server with a task name related to the current task task_name = '{}-{}'.format('ParlAI-Messenger', self.opt['task']) self.server_task_name = \ ''.join(e for e in task_name.lower() if e.isalnum() or e == '-') self.server_url = server_utils.setup_server(self.server_task_name) shared_utils.print_and_log( logging.INFO, 'Webhook address: {}/webhook'.format(self.server_url), should_print=True )
def setup_server(self): """Prepare the Messenger server for handling messages""" if self.bypass_server_setup: return shared_utils.print_and_log( logging.INFO, '\nYou are going to allow people on Facebook to be agents in ' 'ParlAI.\nDuring this process, Internet connection is required, ' 'and you should turn off your computer\'s auto-sleep ' 'feature.\n', should_print=True ) input('Please press Enter to continue... ') shared_utils.print_and_log(logging.NOTSET, '', True) if self.opt['local'] is True: shared_utils.print_and_log( logging.INFO, "In order to run the server locally, you will need " "to have a public HTTPS endpoint (SSL signed) running on " "the server you are currently excecuting ParlAI on. Enter " "that public URL hostname when prompted and ensure that the " "port being used by ParlAI (usually 3000) has external " "traffic routed to it.", should_print=True, ) input('Please press Enter to continue... ') shared_utils.print_and_log(logging.INFO, 'Setting up Messenger webhook...', should_print=True) # Setup the server with a task name related to the current task task_name = '{}-{}'.format('ParlAI-Messenger', self.opt['task']) self.server_task_name = \ ''.join(e for e in task_name.lower() if e.isalnum() or e == '-') self.server_url = server_utils.setup_server( self.server_task_name, local=self.opt['local']) shared_utils.print_and_log( logging.INFO, 'Webhook address: {}/webhook'.format(self.server_url), should_print=True )