Alexa 在提示后得到用户的响应

Alexa getting response from user after prompt

所以我们正在建立一个系统,用户可以在其中设置提醒。目前我的意图是提供一个 Day 和一个 Time。如果我说 set reminder for next tuesday at 9pm 之类的话,在我的意图中,我会看到这些值很好。问题是如果他们说 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 有意图地询问某些内容后,我们如何从用户那里获得响应(对于缺失的信息)?

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

尝试:

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

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

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