【问题标题】:Add Dialogflow/Action/Assistant to routines将 Dialogflow/Action/Assistant 添加到例程
【发布时间】:2019-07-09 14:03:37
【问题描述】:

我正在尝试将 DialogFlow 应用程序Google 智能助理(Google 行动)集成。我需要的是在特定时间内在选定的 Google Home 设备上定期执行我的脚本 - 我设法通过 Routines 做到了这一点。

不幸的是,Routines 的设置并不像我想象的那么简单(您需要多次点击并输入自定义操作名称)。然后我发现可以在 Assistant (Routine suggestions) 中询问用户,让他用更少的必要步骤进行设置。

但我的实现不起作用:

exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
  const agent = new WebhookClient({ request, response });
  ...
  function scheduleRoutine(agent) {
      const intent = agent.arguments.get('UPDATE_INTENT');
      agent.add(new RegisterUpdate({
        intent: intent,
        frequency: 'ROUTINES'
      }));
  }

  let intentMap = new Map();
  ...
  intentMap.set('setup_update', scheduleRoutine)
  agent.handleRequest(intentMap);
});

因为我使用的是WebhookClient,所以我无法像示例中那样调用conv.arguments.get('UPDATE_INTENT')。但是我可以通过实现导致错误的那部分代码:

TypeError: Cannot read property 'get' of undefined
     at scheduleRoutine (/user_code/index.js:71:34)

有人已经用 Dialogflow 实施了常规建议

【问题讨论】:

    标签: dialogflow-es google-assistant-sdk google-api-nodejs-client routines


    【解决方案1】:

    您是否尝试使用来自 actions-on-Google 库的 RegisterUpdate?您不能将该库中的功能与 dialogflow-fulfillment 库混合使用。它们不兼容。

    如果您想在 Google 上使用特定于操作的功能,则必须将该库用于您的 webhook。

    【讨论】:

    • 所以你的意思是使用 ''const app = actionssdk()'' 而不是经典的 webhook,对吗?顺便说一句,没有必要按照上面链接中的“自动发现流程”进行操作,但它对我不起作用……有这方面的经验吗?
    • const app = dialogflow ()
    猜你喜欢
    • 2021-08-05
    • 1970-01-01
    • 1970-01-01
    • 2021-03-05
    • 2019-04-25
    • 1970-01-01
    • 2021-05-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多