bot v4中用户之间的UserProfile状态持续存在 [英] UserProfile state persistent between users in bot v4

查看:102
本文介绍了bot v4中用户之间的UserProfile状态持续存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我有两个机器人实例(如果将机器人部署到Azure时可以是两个仿真器窗口或两个浏览器),则输入的名字对于所有其他实例都是持久的.

When I have two instances of the bot (can be two emulator windows or two browsers if I deploy the bot to Azure), the first name enter is persistent for all the other instances.

实例一

https://imgur.com/sa7AAbn

第二个实例

https://imgur.com/Ct20HE5

我希望机器人再次询问我的名字,无论我有多少实例,该机器人始终将我标识为Brunno.如何更改此行为?

I would expect the bot ask my name again, it does not matter how many instances I have, the bot always identifies me as Brunno. How can I change this behavior?

我遵循了本教程

推荐答案

如果您没有为WebChat的每次对话提供唯一的ID,它将在存储中引用相同的数据对象.因此,要解决此问题,您应该为每个用户或对话实例生成一个随机ID.有关示例,请参见下面的代码段.

If you don't provide WebChat with a unique id for each conversation, it will reference the same data objects in storage. So to the resolve this issue, you should generate a random id for each user or conversation instance. See the code snippet below for an example.

const userID = Date.now() + Math.random().toString(36);

...

window.WebChat.renderWebChat({
directLine: window.WebChat.createDirectLine({ token }),
store,
userID
}, document.getElementById('webchat'));

希望这会有所帮助!

这篇关于bot v4中用户之间的UserProfile状态持续存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆