简体   繁体   English

Dialogflow 未检测到“退出对话”意图

[英]Dialogflow not detecting “Exit conversation” intent

I'm trying to override the default answers for the not-deleteable "exit intent" that Dialogflow provides .我正在尝试覆盖 Dialogflow 提供的不可删除的“退出意图”的默认答案。 This intent is not visible in the intent list of my agent but according to the documentation and to empiric evidence, it's there.此意图在我的代理人的意图列表中不可见,但根据文档和经验证据,它就在那里。 The question is:问题是:

How do I override its default answers?如何覆盖其默认答案?

My exit intent is called "Exit conversation".我的退出意图称为“退出对话”。

  1. I tried using the event 'actions_intent_CANCEL' that the docs provide, but it doesn't seem to work.我尝试使用文档提供的事件“actions_intent_CANCEL”,但它似乎不起作用。 Image.图片。 Intent name and Events.意图名称和事件。
  2. I have set the intent as 'end of conversation' in the Dialogflow Console.我已在 Dialogflow 控制台中将意图设置为“对话结束”。 Image.图片。 Responses.回应。
  3. I have enabled the webhook call for that intent, and connected the webhook to a function that closes the conversation with the same answer that I set up in the Responses field of the Intent Console.我已经为该意图启用了 webhook 调用,并将 webhook 连接到 function 以关闭对话,该答案与我在 Intent 控制台的“响应”字段中设置的答案相同。 Image.图片。 Function Function

Additional images:附加图片:

Image.图片。 Training phrases.训练短语。 It's in spanish:) but it basically says "cancel", "i dont want to continue", etc.它是西班牙语的:) 但它基本上说“取消”、“我不想继续”等。

Image.图片。 Actions and parameters.动作和参数。

The thing is, it is not always even recognizing MY intent.问题是,它甚至不总是认识到我的意图。 Depending on the current flow situation, it sometimes goes to the default intent, sometimes goes to mine.根据当前的流程情况,它有时会进入默认意图,有时会进入我的意图。 When I type 'cancel'/'cancelar' it does not always detect my "Exit conversation" intent, it stays in the current intent and closes the conversation with the default exit Dialogflow intent: 'Ok, cancelled.'当我键入“取消”/“取消”时,它并不总是检测到我的“退出对话”意图,它会停留在当前意图中并使用默认退出 Dialogflow 意图关闭对话:“好的,已取消。” or something like that.或类似的东西。 It sometimes gets mine, though, and gives my answer, but its seems to do so in an unpredictable way.不过,它有时会得到我的答案,并给出我的答案,但它似乎以一种不可预测的方式这样做。

What should I do?我应该怎么办?

Does Dialogflow have a default Exit Intent? Dialogflow 是否有默认的退出意图?

Not necessarily.不必要。 There is a default Cancel Intent (which is the same thing) when using Actions on Google, but this doesn't show up in Dialogflow as an Intent.在 Google 上使用 Actions 时一个默认的 Cancel Intent(同样的事情),但这不会在 Dialogflow 中作为 Intent 显示。 It shows up as an Event.它显示为一个事件。

The table on the page you referred to shows the Intent name, but this is only available if you're working with Actions on Google v2 directly.您引用的页面上的表格显示了 Intent 名称,但这仅在您直接使用 Actions on Google v2 时可用。 The third column shows the Event name that it appears as in Dialogflow.第三列显示它在 Dialogflow 中显示的事件名称。

共同意图表

So why does it seem to exit if I say "exit" or "cancel"?那么,如果我说“退出”或“取消”,为什么它似乎退出了?

This is handled by the Assistant before it hits Dialogflow by default.默认情况下,这是由助手在点击 Dialogflow 之前处理的。 So there isn't a "hidden" Dialogflow Intent that handles it.所以没有处理它的“隐藏”Dialogflow Intent。

You need to specifically create your own Intent to handle it if you want.如果需要,您需要专门创建自己的 Intent 来处理它。

That sounds like it is splitting hairs.这听起来像是在分裂头发。 But ok, how?但是好的,怎么做?

You can opt into cancel events in Dialogflow by您可以通过以下方式选择取消Dialogflow 中的事件

  1. Creating a new Intent.创建一个新的意图。 (You can name it whatever you want, but something like "End Conversation" or "quit.event" is typical.) (您可以随意命名,但典型的是“结束对话”或“quit.event”。)
  2. Set the Event field to "actions_intent_CANCEL".将事件字段设置为“actions_intent_CANCEL”。
  3. You can then set responses, set webhooks, etc, just like you would for other events.然后,您可以设置响应、设置 webhook 等,就像其他事件一样。 You should probably also set the "Ends Conversation" checkbox, but if you don't, it will end anyway.您可能还应该设置“结束对话”复选框,但如果不这样做,它无论如何都会结束。

actions_intent_CANCEL 插图

But I did that?但我这样做了? Why does it only work sometimes?为什么它有时只起作用?

Your description suggested that you included training phrases in your "Exit Conversation" Intent.您的描述表明您在“退出对话”意图中包含了训练短语。

For any Intent in Dialogflow, you should provide either training phrases or an Event, but not both.对于 Dialogflow 中的任何 Intent,您应该提供训练短语事件但不能同时提供两者。 By providing both, you may be confusing Dialogflow.通过同时提供两者,您可能会混淆 Dialogflow。

So how do I add additional phrases that should be used to quit?那么如何添加应该用于退出的其他短语呢?

Make a second Intent with the other training phrases and without the Event.用其他训练短语和没有事件的第二个意图 I usually call it something like "quit", so it is in the list near the other Intent.我通常称它为“退出”之类的东西,因此它位于另一个 Intent 附近的列表中。

退出意图

So I need two Intents?所以我需要两个意图? How can I handle that in my code?我如何在我的代码中处理它? Doesn't that mean I need twice as much code?这是否意味着我需要两倍的代码?

Remember that Intents represent what the user says or does and not how you handle it.请记住,意图代表用户所说或所做的,而不是您如何处理它。

I typically handle everything in a webhook and set the Action string to the same thing for both.我通常处理 webhook 中的所有内容,并将 Action 字符串设置为相同的内容。 The webhook library I use, multivocal , can determine how to handle things base on that Action string.我使用的 webhook 库multivocal可以根据该 Action 字符串确定如何处理事情。 (Other libraries don't use this field, and you don't need to set it if your library doesn't use it.) (其他库不使用此字段,如果您的库不使用,则无需设置。)

If you're using the Dialogflow library (and it looks like you are) for your webhook, you can just have both Intent names call the same handler function.如果您正在为您的 webhook 使用 Dialogflow 库(看起来像),您可以让两个 Intent 名称调用同一个处理程序 function。 It might look something like this:它可能看起来像这样:

function exitConversation( agent ){
  console.log( "Cancelled" );
  agent.end( "Goodbye" );
}
let intentMap = new Map();
intentMap.set( "quit.event", exitConversation );
intentMap.set( "quit", exitConversation );

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

相关问题 无论对话框流v2中的用户输入是什么,如何强制检测特定意图 - How to force detecting specific intent regardless what is user input in dialogflow v2 如何在Dialogflow Webhook中返回对会话的API响应 - How to return API response to conversation in Dialogflow Webhook 在 DialogFlow 中的对话中维护状态 - Maintaining state within a conversation within DialogFlow Dialogflow 实现以触发另一个意图 - Dialogflow fulfillment to trigger another intent 我可以在 Inline Fulfillment Dialogflow 编辑器中跨对话存储计数器吗? - Can I store a counter across conversation in Inline Fulfillment Dialogflow editor? 无法在Dialogflow中存储下一轮对话的变量列表 - Unable to store a list of variables for a next round of conversation in Dialogflow 有没有办法将 Google Dialogflow 中整个聊天机器人对话的日志获取到 Firebase 数据库? - Is there a way to get the logs of the entire chatbot conversation in Google Dialogflow to Firebase Database? 在firebase上使用Dialogflow Fulfillment Library v2结束对话? - End conversation using Dialogflow Fulfillment Library v2 on firebase? 如何通过上下文检测Intent而不查询Dialogflow中的输入 - How to detect Intent by context and not query input in Dialogflow 上传 Intent 函数 Dialogflow V2 - Upload Intent function Dialogflow V2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM