[英]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.