private async Task <DialogTurnResult> TriggerQNA(WaterfallStepContext stepContext, CancellationToken cancellationToken) { var activity = stepContext.Context.Activity.AsMessageActivity(); // var userProfile = await _userProfileState.GetAsync(stepContext.Context, () => new VirtualWorkFriendBot.Models.UserProfileState()); if (!string.IsNullOrEmpty(activity.Text)) { // Get current cognitive models for the current locale. var localizedServices = _services.GetCognitiveModels(); // Get dispatch result from turn state. var dispatchResult = stepContext.Context.TurnState.Get <Luis.DispatchLuis>(StateProperties.DispatchResult); (var dispatchIntent, var dispatchScore) = dispatchResult.TopIntent(); if (IsSkillIntent(dispatchIntent)) { var dispatchIntentSkill = dispatchIntent.ToString(); var skillDialogArgs = new Microsoft.Bot.Solutions.Skills.SkillDialogArgs { SkillId = dispatchIntentSkill }; // Start the skill dialog. return(await stepContext.BeginDialogAsync(dispatchIntentSkill, skillDialogArgs)); } else if (dispatchIntent == DispatchLuis.Intent.q_Faq) { stepContext.SuppressCompletionMessage(true); return(await stepContext.BeginDialogAsync("Faq")); } else if (dispatchIntent == DispatchLuis.Intent.q_Chitchat) { stepContext.SuppressCompletionMessage(true); return(await stepContext.BeginDialogAsync("Chitchat")); } else if (dispatchIntent == DispatchLuis.Intent.q_COVID19) { stepContext.SuppressCompletionMessage(true); return(await stepContext.BeginDialogAsync("COVID19")); } else { stepContext.SuppressCompletionMessage(true); return(await stepContext.BeginDialogAsync("Faq")); } } else { return(await stepContext.NextAsync()); } }
private static void ApplyParentActivityProperties(ITurnContext turnContext, Activity skillActivity, SkillDialogArgs dialogArgs) { // Apply conversation reference and common properties from incoming activity before sending. skillActivity.ApplyConversationReference(turnContext.Activity.GetConversationReference(), true); skillActivity.ChannelData = turnContext.Activity.ChannelData; skillActivity.Properties = turnContext.Activity.Properties; if (dialogArgs != null) { skillActivity.Value = dialogArgs?.Value; } }