无法在 Firebase 云功能的助手中获取用户的响应



我需要一次帮助,我在dialogflow firebase函数中没有得到用户的响应。 请在索引中找到编码.js 在TestIntent中,我想得到用户的响应(用户答案(,我尝试使用"app.intent('Test Intent',(conv,input(",并在"ask"中使用"${input}"。现在我尝试使用"app.intent('Test Intent',(conv,params(",我没有得到用户的响应。请让我知道,如何获得用户的响应">

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) => {
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.pain+`</say-as>.</speak>`);
conv.ask('<speak>Testing the application'+`<say-as >`+qNo+`</say-as>.</speak>`);
});
exports.dialogflowSample = functions.https.onRequest(app);
//});

如果你想准确地返回用户所说的内容,你可以这样做:

app.intent('Test Intent',conv => {
let userRawInput  =   conv.input.raw;
conv.ask("You said exactly: "+userRawInput);
});

最新更新