抱歉,此操作不适用于您的应用。在模拟器中

时间:2018-09-09 10:22:53

标签: google-cloud-functions actions-on-google

我已经创建了一个播放特定医生视频的操作,但是它给出了以下错误,请提出一些解决方案,

当我进入时:播放以下错误提示,播放AK Pancholia医生的视频。

对不起,此操作不适用于您的应用。在模拟器中,您只能调用已添加到应用程序中的操作。有关如何调用您的应用程序的更多信息,请单击此处https://developers.google.com/actions/discovery/explicit

说明::

意图名称::播放视频

培训短语:: 我想播放Amal Banerjee医生的视频。 我想播放AK Pancholia医生的影片 播放AK Pancholia医生视频 播放Amal Banerjee医生的视频。 动作和参数: 名称:玩 参数名称:医生 实体:@doctor 提示:您要播放哪个医生视频?

实现: 为意图填充和广告位填充启用了Webhook调用

实体

实体名称:医生 同义词:AK Pancholia,AK Pancholia博士,

Webhook: 网址:https://us-central1-trd-123.cloudfunctions.net/dialogflowFirebaseFulfillment

firebase云功能:

// See https://github.com/dialogflow/dialogflow-fulfillment-nodejs
// for Dialogflow fulfillment library docs, samples, and to report issues
'use strict';

const functions = require('firebase-functions');
const {WebhookClient} = require('dialogflow-fulfillment');
const {Card, Suggestion} = require('dialogflow-fulfillment');

process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements

exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
  const agent = new WebhookClient({ request, response });
  console.log('Dialogflow Request headers: ' + JSON.stringify(request.headers));
  console.log('Dialogflow Request body: ' + JSON.stringify(request.body));

  function playVideo(agent) {
    agent.add(`responce from input doctor play video`);
  }

  function fallback(agent) {
    agent.add(`I didn't understand`);
    agent.add(`I'm sorry, can you try another doctor?`);
}

  // // Uncomment and edit to make your own intent handler
  // // uncomment `intentMap.set('your intent name here', yourFunctionHandler);`
  // // below to get this function to be run when a Dialogflow intent is matched
  // function yourFunctionHandler(agent) {
  //   agent.add(`This message is from Dialogflow's Cloud Functions for Firebase editor!`);
  //   agent.add(new Card({
  //       title: `Title: this is a card title`,
  //       imageUrl: 'https://developers.google.com/actions/images/badges/XPM_BADGING_GoogleAssistant_VER.png',
  //       text: `This is the body text of a card.  You can even use line\n  breaks and emoji! `,
  //       buttonText: 'This is a button',
  //       buttonUrl: 'https://assistant.google.com/'
  //     })
  //   );
  //   agent.add(new Suggestion(`Quick Reply`));
  //   agent.add(new Suggestion(`Suggestion`));
  //   agent.setContext({ name: 'weather', lifespan: 2, parameters: { city: 'Rome' }});
  // }

  // // Uncomment and edit to make your own Google Assistant intent handler
  // // uncomment `intentMap.set('your intent name here', googleAssistantHandler);`
  // // below to get this function to be run when a Dialogflow intent is matched
  // function googleAssistantHandler(agent) {
  //   let conv = agent.conv(); // Get Actions on Google library conv instance
  //   conv.ask('Hello from the Actions on Google client library!') // Use Actions on Google library
  //   agent.add(conv); // Add Actions on Google library responses to your agent's response
  // }
  // // See https://github.com/dialogflow/dialogflow-fulfillment-nodejs/tree/master/samples/actions-on-google
  // // for a complete Dialogflow fulfillment library Actions on Google client library v2 integration sample

  // Run the proper function handler based on the matched Dialogflow intent name
  let intentMap = new Map();
  intentMap.set('Play_video',playVideo);
  intentMap.set('Default Fallback Intent', fallback);
  // intentMap.set('your intent name here', yourFunctionHandler);
  // intentMap.set('your intent name here', googleAssistantHandler);
  agent.handleRequest(intentMap);
});

1 个答案:

答案 0 :(得分:3)

在Google助手上,“播放”是用于播放音频而不是开始操作的触发短语。

您需要使用明确的trigger phrases之一,例如“与...交谈”或“询问”。