我正在尝试混合对话管理和意图链。我已禁用自动委派。
但我被困在
当用户填写所有槽值时,我使用意图确认并提示他数据是否正确。
如果用户说“否”。
我想出于同样的目的重新启动对话管理。
但我得到的错误是,
“指令“Dialog.Delegate”只能在对话框处于活动状态且尚未完成时使用”。
我尝试用其他意图替换第 15 行,它有效,但当我发送相同意图的指令时则无效。
有谁知道我错过了什么?
const DeniedPostMessageIntentHandler = {
canHandle(handlerInput) {
return handlerInput.requestEnvelope.request.type === 'IntentRequest' &&
handlerInput.requestEnvelope.request.intent.name === 'PostMessageIntent' &&
handlerInput.requestEnvelope.request.dialogState === 'COMPLETED' &&
handlerInput.requestEnvelope.request.intent.confirmationStatus === 'DENIED';
},
handle(handlerInput) {
let speechText = ri('POST_MESSAGE.DENIED');
return handlerInput.jrb
.speak(speechText)
.addDelegateDirective({
name: 'PostMessageIntent',
confirmationStatus: 'NONE',
slots: {}
})
.getResponse();
},
};
注意 - 我正在使用禁用自动委派的对话管理。
Alexa 发送请求dialogState = IN_PROGRESS
and confirmationStatus = DENIED
甚至在发送相同的请求之前dialogState = COMPLETED
and confirmationStatus = DENIED
.
错误
仅当对话框处于活动状态时才能使用指令“Dialog.Delegate”
并且尚未完成”
对此的一种暗示,但需要注意的一件事是,我们可以在dialogState = COMPLETED
但不能出于同样的意图这样做。
因此,如果您想为相同的意图重新启动对话框,当意图确认被拒绝时,您必须在dialogState仍处于状态时执行此操作进行中。如果您想处理以任何其他方式拒绝的意图确认,那么您也可以在dialogState为完全的.
我上述问题的解决方案只需将 canHandle 函数中的dialogState更改为进行中代替完全的.
canHandle(handlerInput) {
return handlerInput.requestEnvelope.request.type === 'IntentRequest' &&
handlerInput.requestEnvelope.request.intent.name === 'PostMessageIntent' &&
handlerInput.requestEnvelope.request.dialogState === 'IN_PROGRESS' &&
handlerInput.requestEnvelope.request.intent.confirmationStatus === 'DENIED';
}
发现这个埋在深处——https://forums.developer.amazon.com/comments/206243/view.html https://forums.developer.amazon.com/comments/206243/view.html
亚马逊应该注意这一点并将其添加到文档中。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)