将自定义调试信息传递给Microsoft bot框架仿真器 [英] Pass custom debug information to Microsoft bot framework emulator

查看:61
本文介绍了将自定义调试信息传递给Microsoft bot框架仿真器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发基于.NET Bot Builder SDK的机器人.

I am developing a bot based on a .NET Bot Builder SDK.

机器人是否有可能将一些调试信息与消息一起传递,因此单击消息后,我可以在Bot Framework Chanel Emulator的 Details 部分中看到它?

Is it possible for a bot to pass some debug information together with the message, so I can see it in the Details section of the Bot Framework Chanel Emulator when the message is clicked?

推荐答案

好问题.是的,这完全有可能.您可以使用要响应的活动的ChannelData属性.输入ChannelData属性的数据必须是有效的JSON例如:

Great Question. Yes, it is entirely possible. You can use the ChannelData property of your activity you are responding with. The data entered into the ChannelData property must be valid JSON For example:

var reply = activity.CreateReply("test");
string json = @"{
    CustomField1: 'Field one value',
    CustomField2Array: [
        'First Element',
        'Second Element'
        ]
    }";


reply.ChannelData = JObject.Parse(json);
await context.PostAsync(reply);

在模拟器中,它将显示为:

In the emulator this will appear as:

"channelData": {
    "CustomField1": "Field one value",
    "CustomField2Array": [
      "First Element",
      "Second Element"
    ]
  }

这篇关于将自定义调试信息传递给Microsoft bot框架仿真器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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