简体   繁体   English

如何在对话流实现中将多个意图映射到一个处理程序?

[英]How to map multiple intents to one handler in dialogflow-fulfillment?

There are multiple intents in my bot that can use a single handler.我的机器人中有多个可以使用单个处理程序的意图。

In v1, this was done by在 v1 中,这是由

function handler (agent){
  //handler code
}

let intentMap = new Map();
intentMap.set('Intent1', handler);
intentMap.set('Intent2', handler);

How can the same be achieved in v2?如何在 v2 中实现相同的功能?

Thanks in advance提前致谢

I found one way to do this我找到了一种方法来做到这一点

app.intent('Intent1', (conv) => {
   //handler code
});

app.intent('Intent2', 'Intent1');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在dialogflow-fulfillment中创建表格 - How to create table in dialogflow-fulfillment 使用 dialogflow-fulfillment 时如何设置 session 实体 - How to set session entities when using dialogflow-fulfillment Dialogflow Fulfillment - 多重意图 - Dialogflow Fulfillment - Mutiple Intents 如何在 dialogflow-fulfillment 的 API V2 中读取/查询响应正文? - How do you read/query the response body in API V2 of dialogflow-fulfillment? 使用 dialogflow-fulfillment 库获取当前用户位置 - Get current user location with dialogflow-fulfillment library 使用 Dialogflow-fulfillment 获取设备位置,而不是使用 Google Actions - Getting device location using Dialogflow-fulfillment, not using Google Actions 从过去的意图访问参数 Dialogflow Fulfillment - Access parameters from past intents Dialogflow Fulfillment 如何在 Dialogflow 实现内联中多次使用 web 抓取? 以及如何在履行内联代码中检测错误? - How to use multiple time web scraping in Dialogflow fulfillment inline? and how to detect error at fulfillment inline code? 实现对话框流中的一个 index.js 文件,具有多个功能/触发到 firestore #AskFirebase - One index.js file in fulfillment dialogflow with multiple functions/trigger to firestore #AskFirebase 如何使用 nodejs 在 Dialogflow 中处理 webhook 实现 - How to handle webhook fulfillment in Dialogflow using nodejs
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM