Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/EmptyTag/162.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Alexa skills kit Alexa Skills:如何使用JOVO将价值从一个意图发送到另一个意图_Alexa Skills Kit - Fatal编程技术网

Alexa skills kit Alexa Skills:如何使用JOVO将价值从一个意图发送到另一个意图

Alexa skills kit Alexa Skills:如何使用JOVO将价值从一个意图发送到另一个意图,alexa-skills-kit,Alexa Skills Kit,我的意向结构如下: async ContactIntent() { const contact_id = this.$inputs.contactid.value; // Contact detail is fetched from API // if this contact is associated with any group // ask user whether he wants to know about the groups // expected

我的意向结构如下:

async ContactIntent() {
   const contact_id = this.$inputs.contactid.value;
   // Contact detail is fetched from API

   // if this contact is associated with any group
   // ask user whether he wants to know about the groups
   // expected answers could either be YES or NO.
   // if YES, I like to jump to ContactGroupIntent intent with
   // present contact_id
   this.ask('User 19588 is associated with 5 groups. Do you want to know what they are? Say YES or NO.')
},

async ContactGroupIntent() {
   // when called directly
   const contact_id = this.$inputs.contactid.value;
   // or I want to grab the id sent from ContactIntent after user says YES

   // API fetches contact groups and outputs the same

},

'AMAZON.YesIntent': function() {
  // Do I need to do something here?
},

'AMAZON.NoIntent': function() {
},
我正在使用JOVO框架来构建技能

问题是: 1.如何在不丢失任何状态的情况下将值从一个意图传递到另一个意图 2.既然我不能同时使用
this.ask()
返回此.toIntent(“intent\u name”)
,我如何在alexa输出某些内容以及当前intent中的值后将用户导航到另一个intent

示例: Intent-A的值为19558 具有上述ID的联系人与5个不同的组相关联。 alexa是否可能输出以下内容:

用户19588与5个组关联。你想知道他们在干什么吗 是吗

并且需要一个
YES
NO
。 如果答案为“是”,alexa将控件从Intent-A移动到Intent-B,使用19588,在Intent-B内部执行其余操作,并最终输出这些组的名称

从过去3天开始,我一直在努力寻找解决方案,谷歌也搜索了很多。但目前还找不到确切解决这种情况的答案

有什么建议吗?我不熟悉Alexa技能开发。

使用课程数据

存储希望其他意图使用的值。例如:

在Intent-A,将值19588作为会话数据的一部分存储在中,并询问一个问题,以便用户回答“是”或“否”

如果用户说“是”,则会触发AMAZON.yesInt,因此

'AMAZON.YesIntent': function() {
    let user_number = this.$session.$data.user_number
    // perform all the appropriate verifications here and do the rest you need to do
},
看看

现在,当您使用
this.ask()
时,麦克风将保持打开状态,等待用户输入,因此调整
语音
重新输入
变量,以提出正确的问题,并期望用户说“是”或“否”

我希望这能有所帮助。请告诉我此答案是否有助于您前进,以及您是否发现了更多问题。

使用会话数据

存储希望其他意图使用的值。例如:

在Intent-A,将值19588作为会话数据的一部分存储在中,并询问一个问题,以便用户回答“是”或“否”

如果用户说“是”,则会触发AMAZON.yesInt,因此

'AMAZON.YesIntent': function() {
    let user_number = this.$session.$data.user_number
    // perform all the appropriate verifications here and do the rest you need to do
},
看看

现在,当您使用
this.ask()
时,麦克风将保持打开状态,等待用户输入,因此调整
语音
重新输入
变量,以提出正确的问题,并期望用户说“是”或“否”

我希望这能有所帮助。请让我知道这个答案是否有助于你前进,如果你发现更多的问题