简体   繁体   English

如何从该意图本身的后续跟踪中递归地触发 DialogFlow 中的意图?

[英]How to recursively trigger an intent in DialogFlow from followup yes of that intent itself?

I'm currently working on a dialogflow chat bot and I'm in a situation where I need to recursively trigger an intent.我目前正在开发一个对话流聊天机器人,并且我处于需要递归触发意图的情况。 The scenario is like this:场景是这样的:

I created a bot for creating flight request from the conversation of user.我创建了一个机器人,用于从用户的对话中创建航班请求。 For a multicity flight request, I need to add multiple flight sectors.对于多城市航班请求,我需要添加多个航班扇区。 After adding each sectors, the user will be prompted whether to add another sector or not.添加每个扇区后,将提示用户是否添加另一个扇区。 If user says yes, then the bot need to trigger the multicity flight request intent again.如果用户说是,那么机器人需要再次触发多城市航班请求意图。 How can I achieve this?我怎样才能做到这一点?

Intents are "triggered" by a user phrase or event.意图由用户短语或事件“触发”。 Trying to trigger them "recursively" probably isn't exactly what you want.尝试“递归”触发它们可能不是您想要的。 Remember - Intents represent what the user says and not how you handle or reply to what they say.请记住 - 意图代表用户所说的内容,而不是您如何处理或回复他们所说的内容。

What it sounds like you're trying to do is:听起来你想做的是:

  • Once a user has given a response, prompt them if they would like to add another sector.一旦用户给出响应,提示他们是否要添加另一个扇区。
  • If they reply yes, prompt them for that information.如果他们回答是,请提示他们提供该信息。 (If they reply no, go handle that.) (如果他们回答不,那就去处理。)
  • Keep repeating this until they reply no.不断重复,直到他们回答不。

Keep in mind that this loop is driven by what the user says .请记住,这个循环是由用户所说的驱动的。

Based on this, the best approach is:基于此,最好的方法是:

  • The Intent that handles the user giving information should have an Input Context, so it will only be triggered when that Context has a lifespan greater than 0.处理用户提供信息的 Intent 应该有一个 Input Context,所以它只会在该 Context 的生命周期大于 0 时触发。
  • When the user responds that they have more information, set that Context to a lifespan greater than 0 with your webhook and prompt them to give you the information.当用户响应他们有更多信息时,使用您的 webhook 将该上下文设置为大于 0 的生命周期,并提示他们向您提供信息。
  • If the user responds they are done, set the Context lifespan to 0 so the Intent won't be triggered.如果用户响应他们已经完成,请将 Context lifespan 设置为 0,这样 Intent 就不会被触发。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM