首页 文章

Alexa在提示后收到用户的回复

提问于
浏览
1

因此,我们正在 Build 一个用户可以设置提醒的系统 . 目前我的意图是设置为提供 DayTime . 如果我说 set reminder for next tuesday at 9pm 之类的东西,在我的意图中,我看到 Value 进展顺利 . 问题是如果让我们说他们说 set reminder for next tuesday 这样的话,他们给了我们一天而不是时间 . 所以在我的意图中,我有这样的回应:

else if(obj.Day.value && !obj.Time.value) {
        this.response.speak(`Looks like you requested a reminder on ${obj.Day.value}, what time would you like the reminder set for?`).listen('Thanks');
        console.log(JSON.stringify(this.response, null, 2));
        this.emit(':responseReady');
      }

我遇到的问题是......我怎么得到他们说的话?我也尝试了 this.emit(':ask', '...') 但我仍然没有看到他们实际说的话 .

如果这令人困惑,我很抱歉,这基本上是一个简化的问题 .

在Alexa询问意图中的某些内容后,我们如何得到用户的响应(缺少信息)?

1 回答

  • 1

    为此,您需要使用 elicitSlot 指令 . Docs found here.

    尝试:

    this.emit(':elicitSlot','slotName','intentName');
    

    如果您将 "Time" 放入上面的 slotName 属性,Alexa将知道您要填充下一个用户对 Time 插槽的响应 .

    在Alexa控制台中,您可以指定Alexa应该如何引出该插槽 . 您甚至可以提供多种询问方式,Alexa将选择一种方式 .

相关问题