private async Task CMSFormComplete(IDialogContext context, IAwaitable <CMSFormRequest> result) { CMSFormRequest cmsRequest = null; try { cmsRequest = await result; } catch (OperationCanceledException) { await context.PostAsync("You Cancelled the form!"); return; } if (cmsRequest != null) { RootDialog.SendEmail(); await context.PostAsync("A request for CMS Account is successfuly raised. You will receive a confirmation email."); await context.PostAsync("Is there anything else I can help you with?"); } else { await context.PostAsync("Form returned empty response!"); } context.Wait(MessageReceivedAsync); }
private async Task MessageReceivedAsync(IDialogContext context, IAwaitable <object> result) { var activity = await result as Activity; string userName = ""; bool userNameExists = context.UserData.TryGetValue("UserName", out userName); string resetStatus = ""; bool resetExists = context.UserData.TryGetValue("reset", out resetStatus); if (!resetExists) { context.UserData.SetValue("reset", ""); } if (activity.Text.ToLower().Equals("reset") || resetStatus.Equals("reset")) { context.UserData.SetValue("UserName", ""); context.UserData.SetValue("reset", ""); await context.PostAsync($"You have reset the data successfully. Please provide your name to re-start."); context.Wait(MessageReceivedAsync); } else if (activity.Text.ToLower().Equals("questions")) { var faqDialog = new BaseQnAMakerDialog(); await context.Forward(faqDialog, AfterFAQDialog, activity, CancellationToken.None); } else if (activity.Text.ToLower().Equals("category")) { var faqDialog = new AzureSearchDialog(); await context.Forward(faqDialog, AfterFAQDialog, activity, CancellationToken.None); } else { if (userNameExists && !(userName.Equals(string.Empty))) { // calculate something for us to return //int length = (activity.Text ?? string.Empty).Length; //// return our reply to the user //await context.PostAsync($"You sent {activity.Text} which was {length} characters"); var faqDialog = new RootDialog(); await context.Forward(faqDialog, AfterFAQDialog, activity, CancellationToken.None); } else { var faqDialog = new BasicLuisDialog(); await context.Forward(faqDialog, AfterFAQDialog, activity, CancellationToken.None); } } }
// Go to https://qnamaker.ai and feed data, train & publish your QnA Knowledgebase. // Parameters to QnAMakerService are: // Required: qnaAuthKey, knowledgebaseId, endpointHostName // Optional: defaultMessage, scoreThreshold[Range 0.0 – 1.0] public BasicQnAMakerDialog() : base(new QnAMakerService(new QnAMakerAttribute(RootDialog.GetSetting("QnAAuthKey"), Utils.GetAppSetting("QnAKnowledgebaseId"), "No good match in FAQ.", 0.5, 1, Utils.GetAppSetting("QnAEndpointHostName")))) { }
// Go to https://qnamaker.ai and feed data, train & publish your QnA Knowledgebase. // Parameters to QnAMakerService are: // Required: subscriptionKey, knowledgebaseId, // Optional: defaultMessage, scoreThreshold[Range 0.0 – 1.0] public BasicQnAMakerPreviewDialog() : base(new QnAMakerService(new QnAMakerAttribute(RootDialog.GetSetting("QnAAuthKey"), Utils.GetAppSetting("QnAKnowledgebaseId"), "No good match in FAQ.", 0.5))) { }