gpt4 book ai didi

node.js - Dialogflow Webhook UpdatePermissions 自定义提示

转载 作者:太空宇宙 更新时间:2023-11-03 22:59:26 24 4
gpt4 key购买 nike

我目前正在尝试在我的dialogflow webhook 中实现推送通知的提示。如果我按照 google 文档 ( https://developers.google.com/actions/assistant/updates/notifications ) 中的操作中描述的方式实现它,它可以正常工作并为用户设置推送通知

conv.ask(new UpdatePermission({
intent: 'send_notification'
}));

当用户激活这部分代码时,系统会提示他们

Is it okay if I send push notifications for my_updates_intent?

此消息没有问题,但是,我至少希望在它前面加上我自己的消息前缀,以便我可以根据上下文显示此提示,具体取决于用户在 session 流中的位置。例如:

Your email has been set. We can set up notifications to keep you informed. Is it okay if I send push notifications for my_updates_intent?

或者

No problem, we wont send you an email. If you are interested, we can set up notifications to keep you informed. Is it okay if I send push notifications for my_updates_intent?

使用 UpdatePermission 继承的 Permission 构造函数,我可以设置一个允许我执行此操作的上下文。

conv.ask(new Permission({
context: "So we can give you directions",
permissions: ['DEVICE_PRECISE_LOCATION'],
});

它将响应:

So we can give you directions, I'll just need to get your street address from Google. Is that ok?

该消息的前半部分是我写的,后半部分来自 Google 根据我请求的权限类型。

从逻辑上讲,我认为也许我可以通过使用基本Permission构造函数来解决这个问题,并将权限设置为更新:

conv.ask(new Permission({
context: 'Your email has been set. We can set up notifications to keep you informed',
permissions: ['UPDATE'],
updatePermissionValueSpec: {
arguments: undefined,
intent: 'send_notification'
}
}));

但是,它的响应与 UpdatePermission 构造函数相同,并且完全忽略我的上下文。我无法找到解决此问题的任何文档或在线资源。这有可能吗?或者我错过了一些明显的东西?

最佳答案

联系 Google 支持人员后,我了解到目前无法自定义 UpdatePermission 消息。

来自支持团队:

Unfortunately, altering this message is not possible for updates and push notifications. I'm adding this to our system as a feedback.

希望这可以帮助其他面临类似问题的人。

关于node.js - Dialogflow Webhook UpdatePermissions 自定义提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51869170/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com