无法在 Firebase 云功能助手中获得用户的响应
unable to get user's response in assisstant on firebase cloud function
我需要一个帮助,我在 dialogflow firebase 函数中没有得到用户的响应。请在 index.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);
//});
如果您想 return 完全按照用户所说的进行操作,您可以这样做:
app.intent('Test Intent',conv => {
let userRawInput = conv.input.raw;
conv.ask("You said exactly: "+userRawInput);
});
我需要一个帮助,我在 dialogflow firebase 函数中没有得到用户的响应。请在 index.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);
//});
如果您想 return 完全按照用户所说的进行操作,您可以这样做:
app.intent('Test Intent',conv => {
let userRawInput = conv.input.raw;
conv.ask("You said exactly: "+userRawInput);
});