问题描述
我正在编写一项Alexa技能,该技能可以从一个意图中获取票证编号,并从不同的意图中获取年龄。基本上,这两个都是数字类型。
I'm writing an Alexa skill that captures a ticket number from one intent and captures age from different intent. and Basically, these two are of type number.
当我尝试输入数字时,它会被捕获到第一个Intent插槽中。这是我的意图架构。
When I'm trying to enter a number, it is being captured in the first Intent's slot. Here is my intent schema.
{
"intents": [
{
"slots": [
{
"name": "TicketNumber",
"type": "AMAZON.NUMBER"
}
],
"intent": "CheckStatusIntent"
},
{
"slots": [
{
"name": "ageAndCurrency",
"type": "AMAZON.NUMBER"
}
],
"intent": "ClientSuggestIntent"
}
]
}
我的样本话语是
CheckStatusIntent I want to check on the status of a ticket
CheckStatusIntent {TicketNumber}
ClientSuggestIntent I have a client meeting tomorrow.
ClientSuggestIntent {ageAndCurrency}
ClientSuggestIntent {personName}
在我的 ClientSuggestIntent
,流程应如下。
用户:我明天有一个客户会议。
Alexa:客户的名字是什么。
用户:Sara John
Alexa:Sara John的年龄是什么
用户:65
User: I have a client meeting tomorrow.Alexa: What is the Client's name.User: Sara JohnAlexa: What is Sara John's ageUser: 65
在这里,我给 65
,而不是与 ClientSuggestIntent
匹配,而是与 TicketNumber
匹配的 CheckStatusIntent
。
Here when I give 65
, instead of matching with in the ClientSuggestIntent
, it is matching with the TicketNumber
of CheckStatusIntent
.
这非常令人困惑,请让我知道我要去哪里哪里以及如何解决
This is very confusing, please let me know where am I going wrong and how can I fix this.
谢谢
推荐答案
您需要使用状态处理程序做到这一点。这是我做过的视频,解释了如何做。 。
You need to use "state handlers" do do this. Here is a video I did that explains how to do it. https://youtu.be/ukR0Aw5P3W8.
如果对节点使用Ask-SDK,则可以使用 Alexa.CreateStateHandler(...)
使用CheckStatusIntent函数创建一个状态处理程序,并使用ClientSuggestIntent函数创建另一个状态处理程序。
If you're using the ask-sdk for node you'd use Alexa.CreateStateHandler(...)
to create one state handler with your CheckStatusIntent function in it and another state handler with your ClientSuggestIntent function.
也请阅读
这篇关于多个Intent共享相同的广告位值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!