node.js - Dialogflow - 关于未使用 NodeJS 显示的实现意图的一个非常基本的问题
问题描述
我花了一个小时搜索所以我放弃了。这个问题有点傻。
我的意图是根据收到的参数做出具体的答复。例如,如果用户说“我因为我的老板而生气”,那么回复将是“老板是最糟糕的”,但如果是关于“妻子”,那么它会说“记住你承诺永远爱她,你的错误”</p>
无论如何,根据我的阅读,我应该使用 app.intent 但我不确定如何使用它
我现在的问题是,这个履行是空的
const functions = require('firebase-functions');
const {
dialogflow
} = require('actions-on-google');
const {WebhookClient} = require('dialogflow-fulfillment');
const {Card, Suggestion} = require('dialogflow-fulfillment');
const app = dialogflow();
process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
const agent = new WebhookClient({ request, response });
console.log('Dialogflow Request headers: ' + JSON.stringify(request.headers));
console.log('Dialogflow Request body: ' + JSON.stringify(request.body));
function angerEmotionCapture(agent) {
let conv = agent.conv();
conv.ask('Hello from the Actions on Google client library!');
agent.add(conv);
}
let intentMap = new Map();
intentMap.set('Default Welcome Intent', welcome);
intentMap.set('Default Fallback Intent', fallback);
intentMap.set('angerEmotionCapture', angerEmotionCapture);
// intentMap.set('your intent name here', googleAssistantHandler);
agent.handleRequest(intentMap);
});
解决方案
推荐阅读
- sql - 单表sql server中的匹配和解锁记录
- r - How do l extract all genes in gene_symbol into a new column that have the same start and end in r
- ios - 编程 UICollectionViewController 中的空白自定义集合单元格
- javascript - nabvar 的 Javascript 按钮不起作用
- docker - zull, eureka server, eureka service 和 docker
- r - 在R中查找几个没有标题的CSV
- python - 如何让 httpretty 在测试期间停止打印异常?
- python - 如何简化这一小段代码?
- javascript - 为什么我的代码只在 javascript 中将此值增加 1 次
- c++ - 没有函数模板的实例与参数列表匹配,参数类型为:(std::string, CommandLineArgumentTypes)