0
我有兩個ActiveDelegate(S):如何識別Microsoft Bot框架IForm中的哪個ActiveDelegate爲TRUE?
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);
}
請幫助我如何確定哪個代表處於活動狀態。感謝任何幫助!