请找到我的index.js文件 . 我想得到用户的意见 . 在“默认欢迎意图”中,我无法使用“输入”获取用户的输入 . 当我使用actionsdk时,我可以通过“输入”获得用户的输入 . 但在对话流中,我无法得到它 . 它在谷歌评估中显示为“欢迎使用我的dialogFlow代理![对象对象] . ”
对于“Test Intent”,我创建了一个实体@ sys.ordinal,参数名称为“ordinal”,我没有得到任何值 . 请让我知道,如何解决这个问题 . 请分享指南,找到对象请求,响应和转换中可用的方法和全局变量
import * as functions from 'firebase-functions';
import * as gApp from 'actions-on-google';
import { myService } from './services/myService';
const {WebhookClient} = require('dialogflow-fulfillment');
const {Card, Suggestion} = require('dialogflow-fulfillment');
import admin from 'firebase-admin';
const app = gApp.dialogflow({debug: true});
process.env.DEBUG = 'dialogflow:debug';
//exports.dialogflowSample = functions.https.onRequest((request, response) =>
//{
app.intent('Default Welcome Intent',(conv,input) => {
conv.ask(`Welcome to my dialogFlow agent! <say-as >${input}</say-as>.</speak>`);
conv.data.question = 'question1';
});
app.intent('Test Intent',(conv,params) => {
let qNo:string = conv.data.question;
conv.ask('<speak>Testing the application'
+`<say-as >`+conv.params.ordinal+`</say-as>.</speak>`);
conv.ask('<speak>Testing the application'+`<say-as >`+qNo+`</say-as>.</speak>`);
});
exports.dialogflowSample = functions.https.onRequest(app);
//});
1 回答
您需要指定要提取的参数名称 . 在你的情况下,它是
ordinal
.Dialogflow Intent Handler的第二个参数是一个对象,它是参数值到参数值的映射 .
你也可以像对象一样使用它 .