我有两个ActiveDelegate(S):
ActiveDelegate isFormFlow =(procReq)=> procReq.UXExp == UserExperience.FormFlow;
ActiveDelegate isLUISFlow =(procReq)=> procReq.UXExp == UserExperience.LUIS;
现在,在我的POST方法中,我想检查FormFlow是处于活动状态还是LUIS,因此我将调用该函数。
public virtual async Task<HttpResponseMessage> Post([FromBody]Activity activity)
{
if (activity != null)
{
// one of these will have an interface and process it
switch (activity.GetActivityType())
{
case ActivityTypes.Message:
if (isFormFlow is TRUE)
{
await Conversation.SendAsync(activity, MakeRootDialogForm);
}
else if (isLUISFlow is TRUE)
{
await Conversation.SendAsync(activity, MakeRootDialogLUIS);
}
break;
case ActivityTypes.ConversationUpdate:
case ActivityTypes.ContactRelationUpdate:
case ActivityTypes.Typing:
case ActivityTypes.DeleteUserData:
default:
Trace.TraceError($"Unknown activity type ignored: {activity.GetActivityType()}");
break;
}
}
return new HttpResponseMessage(System.Net.HttpStatusCode.Accepted);
}
请帮助我确定如何识别哪个代表是活动的。感谢任何帮助!
答案 0 :(得分:0)
Microsoft.Bot.Builder.FormFlow.ActiveDelegate<T>
中使用 FormDialog<T>
来确定特定步骤是否处于活动状态。它通常不用于从多个根对话框中进行选择(通常只有一个根对话框)。