无法在 google 内联助手中针对特定意图添加建议信息片

Unable to add suggestion chips in google assistant inline on a particular intent

我已经实现了代码,它运行良好,但是当我开始使用 addSugestions 添加代码时,错误发生了。这里的任何人都请通过 index.js

分享您的代码实现知识
'use strict';

//Import the Dialogflow module from the Actions on Google client library//

const {dialogflow} = require('actions-on-google');

//Import the firebase-functions package//

const functions = require('firebase-functions');

//Instantiate the Dialogflow client//

const app = dialogflow({debug: true});

//Handle the create_name intent//

app.intent('create_name', (conv, {name}) => {

    //Construct the conversational response//

    conv.ask('Nice to meet you ' + name + '. Would you like to hear a joke?');
});




app.intent('create_yes', (conv) => {

    //Construct the conversational response//

    //conv.ask('Nice to meet you. Would you like to hear a joke?').addSuggestions(['0', '42', '100', 'Never mind']);

    conv.ask('Nice to meet you. Would you like to hear a joke?');
});





//Set the DialogflowApp object to handle the HTTPS POST request//

exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app);

使用 Suggestions object that you add with conv.add() 添加建议。

像这样:

const {dialogflow,Suggestions} = require('actions-on-google');

// ...

app.intent( 'suggest', conv => {
  conv.add( 'Here are some suggestions' );
  conv.add( new Suggestions( ['one','two','whatever'] ) );
});