【发布时间】:2018-09-07 14:57:53
【问题描述】:
我正在 Dialogflow 中开发一个聊天机器人,并希望验证某人的年龄。快速了解一下背景:我正在创建一个聊天机器人来识别护理需求,例如住宅或痴呆症护理。在最初的查询中,我希望能够通过在 Dialogflow 的履行代码中执行快速 IF 语句来确保用户年满 65 岁!
这是我目前的意图: Current Intents
这里是 getUserInfo 意图: getUserInfo intent
这是实现代码:
'use strict';
// Import the Dialogflow module from the Actions on Google client library.
const {dialogflow} = require('actions-on-google');
// Import the firebase-functions package for deployment.
const functions = require('firebase-functions');
// Instantiate the Dialogflow client.
const app = dialogflow({debug: true});
app.intent('careEqnuiry - yourself - getUserInfo', (conv, {age}) => {
const userAge = age;
if (userAge < 65) {
conv.add("You're not old enough to recieve care!");
}
});
// Set the DialogflowApp object to handle the HTTPS POST request.
exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app);
这对我来说是全新的。
【问题讨论】:
-
您面临什么问题?我不明白。
标签: javascript dialogflow-es actions-on-google