问题
I created a bot in Lex and then created two intents within same bot - intent1
and intent2
with utterance get me a taxi now
and I wan a taxi to {Location} on {TravelDate} at {TaxiTime}
respectively(first one in intent1
and second one in intent2
). Both the intents call different lambda function and inside lambda functions I access RDS to add the booking info for taxi. When I test from Lex console by saying either of the two utterances the lambda function executes completely as I can see database record updated but on Lex bot test console I see Reached second execution of fulfillment lambda on same utterance Lex error
. In my code I have this line:
def delegate(session_attributes, slots):
return {
'sessionAttributes': session_attributes,
'dialogAction': {
'type': 'Delegate',
'slots': slots
}
}
def book_taxi(intent_request):
confirmation_status = intent_request['currentIntent']['confirmationStatus']
#bunch of other processing code
logger.debug('Confirmation = {}'.format(confirmation_status))
if confirmation_status == 'Confirmed':
try_ex(lambda: session_attributes.pop('confirmationContext'))
logger.debug('confirmation_context = {}'.format(confirmation_context))
if confirmation_context == 'AutoPopulate':
return elicit_slot(
session_attributes,
intent_request['currentIntent']['name'],
intent_request['currentIntent']['slots']
)
return delegate(session_attributes, intent_request['currentIntent']['slots'])
logger.debug('Booked Taxi at={}'.format(reservation))
My guess is that the delegate()
call in code above is causing the issue because in my log files i can see the first two debug logs as Confirmed and None values but the last logger.debug() is not in the log file which means delegate() got called and thats is causing error on Lex console.
What could be the possible issue for this error?
回答1:
Your Utterance May contains the text that invoke a more than one intent. that's why the problem raised. you chack the uttrances in both the intents and remove one from two similar type utterances.
来源:https://stackoverflow.com/questions/44448538/error-on-lex-bot-console-reached-second-execution-of-fulfillment-lambda-on-the