コード例 #1
0
        private async Task MakeQnAMakerCall(IDialogContext context, string QueryString)
        {
            string KnowledgeBaseId = KeysAndRessourceStrings.KnowledgeBaseIdQuestions;
            string SubscriptionKey = KeysAndRessourceStrings.SubscriptionKeyQnAMaker;

            IQnAMakerRequests     QnAMakerAPI          = new QnAMakerRequests();
            IQnAMakerMatchHandler QnAMakerMatchHandler = new QnAMakerMatchHandler();

            QnAMakerResult QnAMakerResultObject = await QnAMakerAPI.GetQnAMakerResponse(QueryString, KnowledgeBaseId, SubscriptionKey);

            await QnAMakerMatchHandler.QnAMakerResultProcessing(context, QueryString, QnAMakerResultObject);
        }
コード例 #2
0
        private async Task <List <TransferObjectQnA> > MakeNameQnAMakerCall(IDialogContext context, TransferObjectLuis QueryString)
        {
            IQnAMakerRequests        QnAMaker             = new QnAMakerRequests();
            IQnAMakerMatchHandler    qnAMakerMatchHandler = new QnAMakerMatchHandler();
            List <TransferObjectQnA> TransferList         = new List <TransferObjectQnA>();

            string KnowledgeBaseId = KeysAndRessourceStrings.KnowledgeBaseIdConvert;
            string SubscriptionKey = KeysAndRessourceStrings.SubscriptionKeyQnAMaker;

            QnAMakerResult QnAMakerResultObject = await QnAMaker.GetQnAMakerResponse(QueryString.Name_0,
                                                                                     KnowledgeBaseId, SubscriptionKey);

            TransferList.Add(await qnAMakerMatchHandler.QnAMakerResultProcessingWithReturn(context,
                                                                                           QueryString.Name_0, QnAMakerResultObject));

            QnAMakerResult QnAMakerResultObject2 = await QnAMaker.GetQnAMakerResponse(QueryString.Name_1,
                                                                                      KnowledgeBaseId, SubscriptionKey);

            TransferList.Add(await qnAMakerMatchHandler.QnAMakerResultProcessingWithReturn(context,
                                                                                           QueryString.Name_1, QnAMakerResultObject));

            return(TransferList);
        }
コード例 #3
0
        private async Task <TransferObjectQnA> MakeQnAMakerCallforConversion(IDialogContext context, string QueryString)
        {
            string KnowledgeBaseId = KeysAndRessourceStrings.KnowledgeBaseIdConvert;
            string SubscriptionKey = KeysAndRessourceStrings.SubscriptionKeyQnAMaker;

            IQnAMakerRequests     QnAMakerObject       = new QnAMakerRequests();
            IQnAMakerMatchHandler qnAMakerMatchHandler = new QnAMakerMatchHandler();

            // Name to number magic
            QnAMakerResult QnAMakerResultObject = await QnAMakerObject.GetQnAMakerResponse(QueryString, KnowledgeBaseId, SubscriptionKey);

            TransferObjectQnA querystring = await qnAMakerMatchHandler.QnAMakerResultProcessingWithReturn(context, QueryString, QnAMakerResultObject);

            return(querystring);
        }
        private async Task MessageReceivedAsync(IDialogContext context, IAwaitable <object> result)
        {
            var activity = await result as Activity;

            ILuisRequest      LuisAPI     = new LuisRequest();
            IQnAMakerRequests QnAMakerAPI = new QnAMakerRequests();

            string KnowledgeBaseId = KeysAndRessourceStrings.KnowledgeBaseIdQuestions;
            string SubscriptionKey = KeysAndRessourceStrings.SubscriptionKeyQnAMaker;

            QnAMakerResult QnAMakerResultObject = await QnAMakerAPI.GetQnAMakerResponse(activity.Text,
                                                                                        KnowledgeBaseId, SubscriptionKey);

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

            if (await LuisQnADecision(QnAMakerResultObject, LuisResult))
            {
                await LuisCallProcess(context, result, LuisResult);
            }
            else
            {
                await QnACallProcess(context, result, activity.Text, QnAMakerResultObject);
            }
        }