Javascript 无法根据特定目的在google assistant内联中添加建议芯片
我已经实现了代码,它工作得很好,但是当我开始使用addSugestions添加代码时,就出现了错误。这里的任何人都可以通过index.js分享您对代码实现的知识Javascript 无法根据特定目的在google assistant内联中添加建议芯片,javascript,error-handling,actions-on-google,Javascript,Error Handling,Actions On Google,我已经实现了代码,它工作得很好,但是当我开始使用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-func
'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);
添加建议是使用您添加的对象完成的 大概是这样的:
const {dialogflow,Suggestions} = require('actions-on-google');
// ...
app.intent( 'suggest', conv => {
conv.add( 'Here are some suggestions' );
conv.add( new Suggestions( ['one','two','whatever'] ) );
});
非常感谢您的建议和代码,因为我错过了建议声明。谷歌的许多行动即将到来。