将Dialogflow / Action / Assistant添加到例程

问题描述 投票:0回答:1

我正在尝试将DialogFlow应用程序与Google智能助理(Google上的操作)集成。我需要的是在一段时间内通过选择的Google Home设备定期执行我的脚本 - 我设法通过Routines来实现。

不幸的是,Routines的设置并不像我预期的那么容易(你需要经历几次点击并输入自定义动作名称)。然后我发现可以在助手(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 google-assistant-sdk google-api-nodejs-client routines
1个回答
0
投票

您是否尝试使用Google上的操作库中的RegisterUpdate?您不能将该库中的功能与dialogflow-fulfillment库混合使用。他们是不相容的。

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

© www.soinside.com 2019 - 2024. All rights reserved.