private async Task LuisCallProcess(IDialogContext context, IAwaitable <object> result, JObject LuisResult)
        {
            ILuisProcessing LuisAPIProcessing = new LuisProcessing();

            var ProcessedLuisResult = await LuisAPIProcessing.DoProcessing(context, LuisResult);

            string StringName = ProcessedLuisResult.Name_0;

            if (StringName == "")
            {
                context.Wait(MessageReceivedAsync);
            }
            else
            {
                var QnAAnswer = await MakeNameQnAMakerCall(context, StringName);

                if (QnAAnswer.Score < 0.2)
                {
                    await context.PostAsync("I am sorry I could not find the name " + StringName + " in my Database");

                    context.Wait(MessageReceivedAsync);
                }
                else
                {
                    JObject StarwarsAnswer = await CallStarWarsApi(context, QnAAnswer.Answer);
                    await ProcessAndPostToUser(context, ProcessedLuisResult, StarwarsAnswer);

                    context.Wait(MessageReceivedAsync);
                }
            }
        }
コード例 #2
0
        private async Task MessageReceivedAsync(IDialogContext context, IAwaitable <object> result)
        {
            var activity = await result as Activity;

            ILuisRequest    LuisAPI           = new LuisRequest();
            ILuisProcessing LuisAPIProcessing = new LuisProcessing();

            JObject LuisResult = await MakeLuisCall(context, activity.Text, LuisAPI);

            TransferObjectLuis ProcessedLuisResult = await LuisAPIProcessing.DoProcessing(context, LuisResult);

            if (String.IsNullOrEmpty(ProcessedLuisResult.Name_0))
            {
                await context.PostAsync("There is no droid you are looking for.");

                context.Wait(MessageReceivedAsync);
            }
            else
            {
                var QnAAnswer = await MakeQnAMakerCallforConversion(context, ProcessedLuisResult.Name_0);

                if (QnAAnswer.Score < 0.2)
                {
                    await context.PostAsync($"I am sorry I could not find the name {ProcessedLuisResult.Name_0} in my Database");

                    context.Wait(MessageReceivedAsync);
                }
                else
                {
                    JObject StarwarsAnswer = await CallStarWarsApi(context, QnAAnswer.Answer);
                    await ProcessAndPostToUser(context, ProcessedLuisResult, StarwarsAnswer);

                    context.Wait(MessageReceivedAsync);
                }
            }
        }