in lex/__init__.py [0:0]
def get_user_input(self):
self.active_bot.get_user_input()
if self.active_bot.is_failed or self.active_bot.needs_intent or \
self.active_bot.needs_slot:
self.log.debug('{} status is ElicitIntent or ElicitSlot: {}'
.format(self.active_bot_name, self.last_thing_said))
self.log.debug('Checking other bots')
for b in self.bots:
if b == self.active_bot_name:
continue
self.log.debug('Checking bot {}'.format(b))
self.bots[b].send_response(self.last_thing_said, TextMode=True)
if not self.bots[b].needs_intent:
self.log.debug('Found response from {}'
.format(b))
if not self.bots[b].is_fulfilled:
self.log.debug('Switching to {}'.format(b))
self.switch_bot(BotName=b, Restart=False)
else:
self.log.debug('Bot {} fulfilled. Continuing with {}'
.format(b, self.active_bot_name))
self.active_bot.bot.on_transition_in()
break
elif self.active_bot.is_fulfilled or self.active_bot.is_failed:
if self.active_bot.next_intent:
self.send_response(self.active_bot.next_intent,
TextMode=True)
else:
self.log.debug('{} fulfilled.'.format(self.active_bot_name))
if len(self.bot_stack) > 0:
self.switch_bot(BotName=self.bot_stack.pop(), Restart=True)
else:
done = True
if len(self.bots_required) > 0:
for b in self.bots_required:
if not self.bots[b].is_done:
done = False
self.switch_bot(BotName=b, Restart=True)
break
if done and self.need_something_else:
self.active_bot.output(Message='How can I help you?')
elif done and not self.is_all_done:
self.send_response('I may need something else',
TextMode=True)
else:
self.active_bot.output(Message="OK, goodbye.")