diff --git a/Core/Resgrid.Chatbot.NLU/Providers/KeywordIntentClassifier.cs b/Core/Resgrid.Chatbot.NLU/Providers/KeywordIntentClassifier.cs index 4143e30f3..676de0ac1 100644 --- a/Core/Resgrid.Chatbot.NLU/Providers/KeywordIntentClassifier.cs +++ b/Core/Resgrid.Chatbot.NLU/Providers/KeywordIntentClassifier.cs @@ -55,9 +55,9 @@ public class KeywordIntentClassifier : INLUProvider // Call number form ("26-1" / "C26-1"): two-digit year + sequence — resolved by the handler. (R(@"^c?(\d{2,4}-\d+)$"), "call_detail", m => P("callRef", m.Groups[1].Value)), (R(@"^units?$"), "list_units", null), - (R(@"^(my\s+)?status$"), "my_status", null), - // "my staffing" — the my_status handler reports both status and staffing. - (R(@"^(my\s+)?staffing$"), "my_status", null), + (R(@"^(my\s+)?(current\s+)?status$"), "my_status", null), + // Staffing queries use the my_status handler because it reports both status and staffing. + (R(@"^(my\s+)?(current\s+)?staffing$"), "my_status", null), (R(@"^(messages?|msgs?)$"), "list_messages", null), // Unread/new message forms route to the same list handler (it lists unread only). (R(@"^(any\s+|my\s+)?(unread|new)\s+(messages?|msgs?)$"), "list_messages", null), diff --git a/Providers/Resgrid.Providers.Cache/AzureRedisCacheProvider.cs b/Providers/Resgrid.Providers.Cache/AzureRedisCacheProvider.cs index fa9618d97..5bf607071 100644 --- a/Providers/Resgrid.Providers.Cache/AzureRedisCacheProvider.cs +++ b/Providers/Resgrid.Providers.Cache/AzureRedisCacheProvider.cs @@ -273,9 +273,7 @@ public async Task IncrementAsync(string cacheKey, TimeSpan expiration) public bool IsConnected() { - EstablishRedisConnection(); - - return _connection.IsConnected; + return _connection?.IsConnected ?? false; } private string SetCacheKeyForEnv(string cacheKey) @@ -294,17 +292,6 @@ private void EstablishRedisConnection() { int retry = 0; - try - { - if (_connection != null && _connection.IsConnected == false) - { - _connection.Close(); - _connection = null; - } - - } - catch { } - while (_connection == null && retry <= 3) { retry++; diff --git a/Tests/Resgrid.Tests/Chatbot/ChatbotAvailabilityIntentClassifierTests.cs b/Tests/Resgrid.Tests/Chatbot/ChatbotAvailabilityIntentClassifierTests.cs index 3f70bb9d5..b09a49f15 100644 --- a/Tests/Resgrid.Tests/Chatbot/ChatbotAvailabilityIntentClassifierTests.cs +++ b/Tests/Resgrid.Tests/Chatbot/ChatbotAvailabilityIntentClassifierTests.cs @@ -42,6 +42,22 @@ public async Task Classifies_intent(string text, string expectedIntent) result.IntentName.Should().Be(expectedIntent, because: $"\"{text}\" should classify as {expectedIntent}"); } + [TestCase("Current status")] + [TestCase("Current staffing")] + [TestCase("my current status")] + [TestCase("my current staffing")] + public async Task Current_status_queries_are_exact_matches(string text) + { + // Arrange + + // Act + var result = await _classifier.ClassifyAsync(text); + + // Assert + result.IntentName.Should().Be("my_status"); + result.Confidence.Should().Be(1.0, because: "the intent router rejects the 0.60 fuzzy fallback"); + } + [Test] public async Task WhoIsOnCall_extracts_call_reference() { diff --git a/Web/Resgrid.Web/Controllers/HealthController.cs b/Web/Resgrid.Web/Controllers/HealthController.cs index c423fc6e8..e06c2c626 100644 --- a/Web/Resgrid.Web/Controllers/HealthController.cs +++ b/Web/Resgrid.Web/Controllers/HealthController.cs @@ -35,7 +35,7 @@ public async Task GetCurrent() result.WebsiteVersion = Assembly.GetEntryAssembly().GetName().Version.ToString(); result.SiteId = "0"; result.CacheOnline = _healthService.IsCacheProviderConnected(); - result.ServiceBusOnline = _healthService.IsCacheProviderConnected(); + result.ServiceBusOnline = await _healthService.IsServiceBusProviderConnected(); var dbTime = await _healthService.GetDatabaseTimestamp(); diff --git a/Web/Resgrid.Web/Startup.cs b/Web/Resgrid.Web/Startup.cs index 123370bfb..c4fcc5839 100644 --- a/Web/Resgrid.Web/Startup.cs +++ b/Web/Resgrid.Web/Startup.cs @@ -616,9 +616,9 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF app.UseAuthentication(); app.UseAuthorization(); - - app.UseSession(); - + app.UseWhen( + context => !string.Equals(context.Request.Path.Value, "/health/getcurrent", StringComparison.OrdinalIgnoreCase), + authenticatedApp => authenticatedApp.UseSession()); app.UseMiddleware(); app.UseRequestLocalization();