public void LuisRecognizer_ObfuscateSensitiveData() { var model = new LuisModel(Guid.NewGuid().ToString(), "abc", new Uri("http://luis.ai")); var obfuscated = LuisRecognizerMiddleware.RemoveSensitiveData(model); Assert.AreEqual(LuisRecognizerMiddleware.Obfuscated, obfuscated.SubscriptionKey); Assert.AreEqual(model.ApiVersion, obfuscated.ApiVersion); Assert.AreEqual(model.ModelID, obfuscated.ModelID); Assert.AreEqual(model.Threshold, obfuscated.Threshold); Assert.AreEqual(model.UriBase.Host, obfuscated.UriBase.Host); }
public AdapterWithErrorHandler(IConfiguration configuration, LuisRecognizerMiddleware luisRecognizerMiddleware, ILogger <BotFrameworkHttpAdapter> logger) : base(configuration, logger) { MiddlewareSet.Use(luisRecognizerMiddleware); OnTurnError = async(turnContext, exception) => { // Log any leaked exception from the application. logger.LogError($"Exception caught : {exception.Message}"); // Send a catch-all apology to the user. await turnContext.SendActivityAsync("Se ha producido un error."); }; }
public async Task Luis_TopIntentAndEntities() { if (luisAppId == null || subscriptionKey == null) { Debug.WriteLine($"Missing Luis Key- Skipping test"); return; } LuisRecognizerMiddleware recognizer = new LuisRecognizerMiddleware(luisAppId, subscriptionKey); var context = TestUtilities.CreateEmptyContext(); context.Request.AsMessageActivity().Text = "I want a ham and cheese sandwich"; IList <Intent> res = await recognizer.Recognize(context); Assert.IsTrue(res.Count == 1, "Incorrect number of intents"); Assert.IsTrue(res[0].Name == "sandwichorder", "Incorrect Name"); Assert.IsTrue(res[0].Entities.Count > 0, "No Entities Found"); Assert.IsTrue(((LuisEntity)res[0].Entities[0]).Type == "meat"); Assert.IsTrue(((LuisEntity)res[0].Entities[0]).Value == "ham"); }