检查连接到聊天机器人是否成功

发布于 2025-01-31 23:50:51 字数 334 浏览 4 评论 0原文

我目前正在Xamarin.Forms应用程序中使用聊天机器人。应用程序与机器人之间的通信正在使用DirectLine SDK(C#)进行。考虑到自2017年以来没有更新的SDK,我的文档却相当乏味,因此我在几个方面遇到了墙壁。

为了让用户知道聊天机器人是否可以访问,我想添加一个简单的状态图标,指示聊天机器人的状态。此状态图标链接到聊天机器人的连接状态,但这是我撞墙的地方。有没有办法检查与聊天机器人是否成功的连接?我已经尝试使用ong.andrew的某种更新的通用版本,但是未能连接似乎会导致不可接受的例外。

缺乏文档和一般丢失的信息并不是很有帮助,因此我希望这里有人在使用Directline SDK方面有经验。提前致谢!

I'm currently working on a chatbot inside a Xamarin.Forms application. Communication between the application and the bot is being done using the DirectLine SDK (C#). I'm running into walls on several fronts, considering the SDK hasn't been updated since 2017 and its documentation is rather lackluster.

In order to let a user know whether the chatbot is accessible or not, I'd like to add a simple status icon indicating the status of the chatbot. This status icon is linked to the connection status of the chatbot, but this is where I've hit a wall. Is there a way to check whether connection to the chatbot has succeeded? I've tried using the somewhat updated Universal version by ong.andrew, but failure to connect seems to result in an uncatchable exception.

Lack of documentation and general missing information aren't very helpful, so I'm hoping someone on here has experience with the use of the DirectLine SDK. Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

居里长安 2025-02-07 23:50:51

如果您的意思是像在线指示器之类的内容,那么最简单的方法可能是定期发送快速请求(例如,使用Watermark获取最后一条消息)并检查回来的响应。如果机器人闲置,这也将有助于唤醒机器人。如果您获得了2xx响应代码以外的其他内容,则知道该机器人有问题。然后,您可以相应地更新XAML。

或者,由于直接行确实没有“在线指示”,因此您还可以向用户报告是否通过使用颜色,文本等成功发送了每个消息。直线通道应导致HTTP响应代码。用它来决定要告诉用户的内容。

希望这是有道理的。

If you mean something like an online indicator, the simplest way would probably be to periodically send a quick request (such as getting the very last message using the watermark) to the bot and check the response that comes back. This will also serve to wake the bot up if it has gone idle. If you get something other than a 2xx response code, you know there's something wrong with the bot. You can then update the XAML accordingly.

Alternatively, since Direct Line doesn't really have an "online indicator" as such, you could also report to the user whether each message was sent successfully or not through the use of color, text, etc. Once again, each interaction with the Direct Line channel should result in an HTTP response code. Use that to decide what to tell the user.

Hope that makes sense.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文