gpt4 book ai didi

javascript - 无法根据特定意图在谷歌助手内联中添加建议芯片

转载 作者:行者123 更新时间:2023-11-29 23:14:24 25 4
gpt4 key购买 nike

我已经实现了代码,它运行良好,但是当我开始使用 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 完成的使用 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'] ) );
});

关于javascript - 无法根据特定意图在谷歌助手内联中添加建议芯片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53220609/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com