alexa - addElicitSlotDirective 的奇怪行为
问题描述
我的技能发生了一些奇怪的事情。
我将错误隔离为不同的技能。
技能ID: amzn1.ask.skill.6918614f-1f20-4ea3-bad4-b2284a296938
在技能中,我有一个意图——HelloWorldIntent。
意图有 2 个插槽 - lala 和 bibi。
它们中的每一个的默认提示(当 Alexa 在用户回复中找不到合适的槽值时调用的提示)是:
lala-对不起,我没听懂。lala的价值是什么?
比比比比比
***自动委托界面开启
我在 Lala 插槽的 LaunchRequestHandler 中有一个 addElicitSlot 操作,
并在 HelloWorldIntentHandler 中用于 bibi 插槽。
然而,当我试图给拉拉一个价值时,
我得到了 bibi 的默认提示。
交互模型——
{
"interactionModel": {
"languageModel": {
"invocationName": "check it",
"modelConfiguration": {
"fallbackIntentSensitivity": {
"level": "LOW"
}
},
"intents": [
{
"name": "AMAZON.CancelIntent",
"samples": []
},
{
"name": "AMAZON.HelpIntent",
"samples": []
},
{
"name": "AMAZON.StopIntent",
"samples": []
},
{
"name": "HelloWorldIntent",
"slots": [
{
"name": "lala",
"type": "AMAZON.SearchQuery"
},
{
"name": "bibi",
"type": "AMAZON.SearchQuery"
}
],
"samples": [
"hello {lala}",
"ya {bibi}"
]
},
{
"name": "AMAZON.NavigateHomeIntent",
"samples": []
},
{
"name": "AMAZON.FallbackIntent",
"samples": []
}
],
"types": []
},
"dialog": {
"intents": [
{
"name": "HelloWorldIntent",
"confirmationRequired": false,
"prompts": {},
"slots": [
{
"name": "lala",
"type": "AMAZON.SearchQuery",
"confirmationRequired": false,
"elicitationRequired": true,
"prompts": {
"elicitation": "Elicit.Slot.716071660021.1504772685502"
}
},
{
"name": "bibi",
"type": "AMAZON.SearchQuery",
"confirmationRequired": false,
"elicitationRequired": true,
"prompts": {
"elicitation": "Elicit.Slot.1152666376659.1399331737295"
}
}
]
}
],
"delegationStrategy": "ALWAYS"
},
"prompts": [
{
"id": "Elicit.Slot.716071660021.1504772685502",
"variations": [
{
"type": "PlainText",
"value": "sorry, i didnt get that. what is the value of lala?"
}
]
},
{
"id": "Elicit.Slot.1152666376659.1399331737295",
"variations": [
{
"type": "PlainText",
"value": "bibibibbb"
}
]
}
]
}
编码-
const LaunchRequestHandler = {
canHandle(handlerInput) {
return Alexa.getRequestType(handlerInput.requestEnvelope) === 'LaunchRequest';
},
handle(handlerInput) {
const speakOutput = handlerInput.t('WELCOME_MSG');
return handlerInput.responseBuilder
.speak(speakOutput)
.reprompt(speakOutput)
.addElicitSlotDirective('lala', {
name: 'ChallengeIntent',
confirmationStatus: 'NONE',
slots: {}
})
.getResponse();
}
};
const HelloWorldIntentHandler = {
canHandle(handlerInput) {
return Alexa.getRequestType(handlerInput.requestEnvelope) === 'IntentRequest'
&& Alexa.getIntentName(handlerInput.requestEnvelope) === 'HelloWorldIntent';
},
handle(handlerInput) {
const lala=Alexa.getSlotValue(handlerInput.requestEnvelope, 'lala')
const speakOutput =`yay the value is ${lala}`;
return handlerInput.responseBuilder
.speak(speakOutput)
.addElicitSlotDirective('bibi', {
name: 'ChallengeIntent',
confirmationStatus: 'NONE',
slots: {}
})
//.reprompt('add a reprompt if you want to keep the session open for the user to respond')
.getResponse();
}
};
我很沮丧,请帮助我:(
我需要在八月底之前提交我的工作。
Tnx:)
解决方案
是因为您在将新的意图对象传递给 addElicitSlotDirective 时正在重置意图吗?尝试传递现有意图。
handlerInput.requestEnvelope.request.intent
.speak(speakOutput)
.addElicitSlotDirective('bibi', handlerInput.requestEnvelope.request.intent)
推荐阅读
- php - 如何从 json 文件中求和 php 中的时间?
- flutter - 你如何在 Flutter TimePicker 中存储 DateTime 值
- logstash - 适用于 AWS ELB 的 Grok 过滤器
- git - 如何使用 gerrit-review 命令行更新 gerrit 中的用户定义字段?
- sql - 如何使用 MIN 子句从同一行获取记录?
- python - 蟒蛇 | 返回类似于“os.get_terminal_size”的内容
- anylogic - Anylogic状态图计时器?
- r - R - dplyr left_join() - 多个匹配 - 如何重新组合......?
- mongodb - 带有聚合方法的mongo查询
- python - 从计算元组项出现次数的元组创建嵌套字典