Botframework 在团队中测试时,Bot框架stepContext.context.activity.value将作为空对象出现

Botframework 在团队中测试时,Bot框架stepContext.context.activity.value将作为空对象出现,botframework,chatbot,microsoft-teams,Botframework,Chatbot,Microsoft Teams,下面是一个瀑布式方法,它将在第一步显示英雄卡。在第二步中,它将接收该值并根据选择开始一个对话框。然而,当在团队中测试时,我面临一个问题。请查看以下详细信息 代码: async serviceRequestTypes(stepContext) { const srTypes = stepContext.options; console.log('INSIDE SR TYPES'); const serviceRequestCa

下面是一个瀑布式方法,它将在第一步显示英雄卡。在第二步中,它将接收该值并根据选择开始一个对话框。然而,当在团队中测试时,我面临一个问题。请查看以下详细信息

代码:

async serviceRequestTypes(stepContext) {
            const srTypes = stepContext.options;
            console.log('INSIDE SR TYPES');
            const serviceRequestCard = CardFactory.heroCard('Service Requests', 'Please choose the belwo options to create the appropriate service Requests',
                        CardFactory.images(['https://www.usnews.com/dims4/USNEWS/65f1856/2147483647/thumbnail/970x647/quality/85/?url=http%3A%2F%2Fcom-usnews-beam-media.s3.amazonaws.com%2Fbe%2Fdd%2F8f25b4174b6398285139452fb7d5%2F190313-collegeapplication-stock.jpg']),
  CardFactory.actions([
                            {
                                type: 'messageBack',
                                title: 'Create Generic Service Request',
                                value: 'Create Generic Service Request'
                            },
                            {
                                type: 'messageBack',
                                title: 'Create Application Service Request',
                                value: 'Create Application Service Request'
                            },
                            {
                                type: 'messageBack',
                                title: 'Create Virtual Desktop Service Request',
                                value: 'Create Virtual Desktop Service Request'
                            }
                        ])
                    );

                    await stepContext.context.sendActivity({ attachments: [serviceRequestCard], attachmentLayout: AttachmentLayoutTypes.carousel });
                    return { status: DialogTurnStatus.waiting };
                }
            }

            async classifySRDialog(stepContext) {
                console.log('INSIDE CLASSIFY SR DIALOG');
                **console.log(stepContext.context.activity.value);
                stepContext.values.classifiedSR = stepContext.context.activity.value;**
                console.log(stepContext.values.classifiedSR);
                if (stepContext.values.classifiedSR === 'Create Generic Service Request') {
                    return await stepContext.beginDialog('createGenericSRDialog');
                } else if (stepContext.values.classifiedSR === 'Create Application Service Request') {
                    console.log('Inside Application SR');
                    return await stepContext.beginDialog('createApplicationDialog');
                } else if (stepContext.values.classifiedSR === 'Create Virtual Desktop Service Request') {
                    return await stepContext.beginDialog('createVDIDialog');
                } else {

                }
            }
        }
在第二个瀑布方法中,我需要

stepContext.values.classifiedSR=stepContext.context.activity.value

这在bot emulator和webchat中工作得非常好。但是,当使用microsoft团队对其进行测试时


stepContext.context.activity.value作为{}对象出现。请提供任何帮助。

首先,您应该知道,任何渠道(团队、Facebook、网络聊天等)都会以不同的方式处理传递给它的数据(这样做时可能有不同的要求)。传回的结果可能会也将因此而有所不同,这就是为什么您会在Emulator和团队之间看到不同的响应

对于Emulator,在英雄卡的
value
属性中传递的值,指定为type
messageBack
ActionTypes:messageBack
,可以是任何类型(引用)

对于团队,传入的值必须是唯一标识符或JSON对象(引用)

如果您将代码调整为发送JSON对象,您应该(在团队中)得到您想要的结果


希望有帮助

首先,也是最重要的一点,您应该知道,任何渠道(团队、Facebook、网络聊天等)都会以不同的方式处理传递给它的数据(这样做时可能有不同的要求)。传回的结果可能会也将因此而有所不同,这就是为什么您会在Emulator和团队之间看到不同的响应

对于Emulator,在英雄卡的
value
属性中传递的值,指定为type
messageBack
ActionTypes:messageBack
,可以是任何类型(引用)

对于团队,传入的值必须是唯一标识符或JSON对象(引用)

如果您将代码调整为发送JSON对象,您应该(在团队中)得到您想要的结果

希望有帮助