简体   繁体   English

如果没有意图匹配,如何防止谷歌动作关闭对话?

[英]How to prevent google action from closing the conversation if there is no intent match?

whenever default fallback intent is triggered 3 times in a row conversation is getting closed with the response, my test app left the conversation.每当连续 3 次触发默认回退意图时,对话都会随着响应关闭,我的测试应用程序就会离开对话。 How can i prevent this from happenning and also only exit from the action only when user wants to exit from the action.如何防止这种情况发生,并且仅当用户想要退出操作时才退出操作。

The Actions on Google docs mention a conv.data.fallbackCount object, which you can read about in the No-match reprompting subsection: Google 文档上的操作提到了一个conv.data.fallbackCount对象,您可以在No-match reprompting小节中阅读该对象:

 app.intent('Default Fallback Intent', (conv) => {

 conv.data.fallbackCount++;

 // Provide two prompts before ending game

 if (conv.data.fallbackCount === 1) {
   conv.contexts.set(DONE_YES_NO_CONTEXT, 5);
   conv.ask('Are you done playing Number Genie?');
 } else {
   conv.close(`Since I'm still having trouble, so I'll stop here. ` +
     `Let’s play again soon.`);
 }

});

Although it's arguably better conversation design to leave this variable alone -- thereby letting the conversation close when the counter increments to three -- you could try resetting conv.data.fallbackCount manually, like:尽管单独保留此变量可以说是更好的对话设计- 从而在计数器增加到 3 时让对话关闭 - 您可以尝试手动重置conv.data.fallbackCount ,例如:

conv.data.fallbackCount = 0;

At least right now with the new Google Action you can just redirect the user to the current scene again on a NO_MATCH intent.至少现在使用新的 Google Action,您可以在NO_MATCH意图上再次将用户重定向到当前场景。

Basically in your webhook just set:基本上在你的 webhook 中设置:

webhookResponseJson.scene.next.name = webhookRequestJson.scene.name

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

相关问题 使用 dialogflow 为 google 操作创建对话结束,并在默认后备意图后停止重复最后一个响应 - creating a end of conversation for a google action using dialogflow and stop repeating the last response after a default fallback intent 如何在对话期间强制谷歌动作切换语言? - How do I force google action to switch the language during conversation? 如何问“这有用吗?” 在呈现来自 Intent 的响应后对话结束时在 DialogFlow 中 - How to ask "Was this helpful?" in DialogFlow at the end of conversation after rendering the response from Intent 如何在 DialogFlow Fullfilment 中退出对话以进行操作 - How to exit conversation in DialogFlow Fullfilment for an Action 具有多个输入参数的 Google Action Intent - Google Action Intent with multiple input parameters 谷歌操作列表选择匹配错误的意图 - Google action list selection matching wrong intent 从 DialogFlow 对话中取消关联 Google 帐户 - Unlinking the Google account from DialogFlow conversation Dialogflow 未检测到“退出对话”意图 - Dialogflow not detecting “Exit conversation” intent Google 操作不会以取消意图停止音频 - Google action don't stop audio with cancel intent Google 操作不会发送 actions.intent.MEDIA_STATUS - Google action does not send actions.intent.MEDIA_STATUS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM