この問題の回避策があります。
if ChooseCase == 'Case 1' and CaseOneChosen == 'Yes' and not CaseOneQuestion:
# Assign current inputTranscript to slots
intent_request['currentIntent']['slots']['CaseOneQuestion'] = intent_request['inputTranscript']
CaseOneQuestion = intent_request['inputTranscript']
# After the user enter the text, check if the current slot value is the same as the previous slot,
# if it is, then this is the first time the user elicit this slot
# Else, assign the current inputTranscript to the current slot (done above)
if intent_request['currentIntent']['slots']['CaseOneQuestion'] == intent_request['currentIntent']['slots']['CaseOneChosen']:
return elicit_slot(
output_session_attributes,
intent_request['currentIntent']['name'],
intent_request['currentIntent']['slots'],
'CaseOneQuestion',
{'contentType': 'PlainText', 'content': 'Answer for case 1'},
None
)
説明: 前のスロットは「CaseOneChosen」で、このスロットの値は「Yes」です。3 行目でその値をスロット「CaseOneQuestion」に割り当てます。両方とも同じ値になったので、if ステートメントは TRUE になります。ボットは、ユーザーにスロット「CaseOneQuestion」を引き出しさせます (ユーザーが「cat」と入力したと仮定します)。この後、3 行目で「cat」を「CaseOneQuestion」スロットに割り当てます。したがって、if ステートメントは FALSE になります。ボットは、ユーザーに "CaseOneQuestion" スロットを引き出すように求めるプロンプトを再表示しなくなりました。スロットの値は「cat」になりました。お役に立てれば。