나는 어떤 사용자 입력에 의해 방아쇠를 당긴 intent-A
가있다. 응답이 사용자에게 주어 졌을 때 Close
대신 ConfirmIntent
을 사용 했으므로 다른 의도를 바꾸거나 연결할 수 있습니다 (intent-B
).아마존 Lex 어떤 응답에 ConfirmIntent을 수락
사용자 유형이 "yes"
인 경우 의도가 실행되고 사용자 입력이 "no"
인 경우 이상적입니다. 문제는 내가 입력 한 내용에 관계없이 intent-B
이 실행되고 있다는 것입니다.
나는 here, here 및 here에서 약 ConfirmIntent
을 읽었습니다.
호출 코드 :
session_attributes = {"confirmationContext": "AutoPopulate"}
return confirm_intent(session_attributes , 'intent-B', slots, 'Do you want to invoke intent-B')
ConfirmIntent 코드 :. 로그에서
def confirm_intent(session_attributes, intent_name, slots, message):
return {
'sessionAttributes': session_attributes,
'dialogAction': {
'type': 'ConfirmIntent',
'intentName': intent_name,
'slots': slots,
'message': {
'contentType': 'PlainText',
'content': message
}
}
}
내가 볼 수 confirmationStatus': 'Denied'
내가 "no
을 입력 "하지만 그렇다하더라도 intent-B
가 호출 될 때
내가 잘못 무언가를 부르거나이 방법으로 설계 되었습니까?
참고 : 내가 당신을 올바르게 처리하는 intent-B
if 'confirmationStatus' in intent_request['currentIntent'] and intent_request['currentIntent']['confirmationStatus'] == 'Denied':
return close("Ok, let me know if you need anything else.", session_attributes)
그래서 intent-B가 항상 호출되지만 "confirmationStatus"의 유효성을 검사하여 DialogCodeHook에서 실행을 멈출 수 있습니다. 그 맞습니까? – sid8491
@ sid8491 필자는 필요할 때'intent-B' 만 호출하기 위해'Delegate'를 사용하여 사용할 수있는 또 다른 접근법을 추가했습니다. 이것은 계산 상 비쌉니다. 따라서 더 좋은 방법이라고 생각하시면 전화하겠습니다. – Milk
감사합니다. 도움이됩니다. :) – sid8491