Alexa自定义技能非法槽值触发FallbackIntent而非校验提示问题
问题根因
你当前的配置没有触发槽校验的核心原因是:用户输入what's for dinner时根本没有匹配到GetMenuIntent,直接被判定为超出意图覆盖范围进入了FallbackIntent,自然不会执行后续的槽校验逻辑。不匹配的原因是你配置的所有GetMenuIntent样本都同时包含meal和date两个槽位,没有配置仅包含meal槽位的样本,因此不带日期的查询无法命中该意图。
调整步骤
1. 补全GetMenuIntent的样本
在现有样本基础上,新增仅携带meal槽位的单槽样本,修改后的样本配置示例如下:
"samples": [ "whats for {meal} {date}", "what will you have for {meal} {date}", "what is on the menu for {meal} {date}", "what are we having for {meal} {date}", "what we're having for {meal} {date}", // 新增以下单槽样本 "whats for {meal}", "what will you have for {meal}", "what is on the menu for {meal}", "what are we having for {meal}", "what we're having for {meal}" ]
2. 可选:调整槽位必填配置
如果date是可选槽位,保持现有elicitationRequired: false即可;如果需要用户必须提供日期才能查询,将date槽的elicitationRequired设为true,并配置对应的引导提示语,Alexa会在用户未提供日期时主动询问。
3. 重新构建模型
保存修改后的交互模型,重新构建后再测试,此时what's for dinner会首先命中GetMenuIntent,再触发meal槽的校验规则,返回你预先配置的错误提示。
内容的提问来源于stack exchange,提问作者Tim Schmidt
相关产品推荐
相关产品推荐

