예제 #1
0
        private static Recognizer GetQnARecognizer(IConfiguration configuration)
        {
            if (string.IsNullOrEmpty(configuration["qna:qnamakerSampleBot_en_us_qna"]) || string.IsNullOrEmpty(configuration["qna:hostname"]) || string.IsNullOrEmpty(configuration["qna:endpointKey"]))
            {
                throw new Exception("NOTE: QnA Maker is not configured for RootDialog. Please follow instructions in README.md. To enable all capabilities, add 'qnamaker:qnamakerSampleBot_en_us_qna', 'qnamaker:LuisAPIKey' and 'qnamaker:endpointKey' to the appsettings.json file.");
            }

            var recognizer = new QnAMakerRecognizer()
            {
                HostName        = configuration["qna:hostname"],
                EndpointKey     = configuration["qna:endpointKey"],
                KnowledgeBaseId = configuration["qna:qnamakerSampleBot_en_us_qna"],

                // Property path where previous qna id is set. This is required to have multi-turn QnA working.
                QnAId = "turn.qnaIdFromPrompt",

                // Disable teletry logging
                LogPersonalInformation = false,

                // Disable automatically including dialog name as meta data filter on calls to QnA Maker.
                IncludeDialogNameInMetadata = false
            };

            return(recognizer);
        }
        public void LogPiiIsFalseByDefault()
        {
            var recognizer = new QnAMakerRecognizer()
            {
                HostName        = Hostname,
                EndpointKey     = EndpointKey,
                KnowledgeBaseId = KnowledgeBaseId
            };
            var activity = MessageFactory.Text("hi");
            var context  = new TurnContext(new TestAdapter(), activity);
            var dc       = new DialogContext(new DialogSet(), context, new DialogState());

            var(logPersonalInfo, _) = recognizer.LogPersonalInformation.TryGetValue(dc.State);

            // Should be false by default, when not specified by user.
            Assert.False(logPersonalInfo);
        }