如何使用针对节点js的sdk v4重新启动与机器人的连接 [英] how to restart a connection to the bot using sdk v4 for node js

查看:89
本文介绍了如何使用针对节点js的sdk v4重新启动与机器人的连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用sdk v4开发用于节点js的机器人,我想结束当前对话并在用户单击按钮时开始新的聚会.我尝试await this.conversationState.clear(turnContext)清除对话数据,但对话ID没有变化.请建议如何触发对话更新活动,以重新启动与机器人的连接.

I am developing a bot using sdk v4 for node js and i want to end the current conversation and start new convesation when user click on a button. I tried await this.conversationState.clear(turnContext) to clear conversation data but there is no change in conversation Id. please suggest how to trigger conversationUpdate activity to restart the connection to the bot.

推荐答案

Bot模拟器和Azure门户Web聊天均包含一种重新启动按钮,该按钮可以清除对话历史记录并生成新的对话ID.这是通过刷新Web聊天来完成的.

Both the Bot Emulator and the Azure Portal Web Chat's contain a sort of restart button that clears the conversation history and generates a new conversation ID. This is accomplished by refreshing Web Chat.

每次将机密交换令牌时,Direct Line都会生成一个新的对话ID.如果将直接线路机密直接传递给Web聊天并让Web聊天将其交换为令牌,那么生成新对话ID所需要做的就是

Direct Line generates a new conversation ID every time the secret is exchanged for a token. If you are passing a Direct Line secret to Web Chat directly and letting Web Chat exchange it for a token, then all you must do to generate a new conversation ID is refresh the page or frame.

如果您将秘密存储在私有的(推荐)地方,然后自己将其交换为令牌并将令牌传递给Web Chat,则只需再次执行此操作即可生成新的会话ID.

If you are storing the secret somewhere private (recommended) and exchanging it for a token yourself and passing the token to Web Chat, then just do that again to generate a new conversation ID.

这篇关于如何使用针对节点js的sdk v4重新启动与机器人的连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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