From 6bd2af41511b70637ab6aa5eab86e6a9c98e5a4b Mon Sep 17 00:00:00 2001 From: Haiping Chen Date: Thu, 20 Feb 2025 09:33:47 -0600 Subject: [PATCH] Remove IConversationSideCar dependency --- .../Conversations/Services/ConversationStateService.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs b/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs index a2b55d13..531bf06d 100644 --- a/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs +++ b/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs @@ -27,7 +27,6 @@ public class ConversationStateService : IConversationStateService, IDisposable private readonly ILogger _logger; private readonly IServiceProvider _services; private readonly IBotSharpRepository _db; - private readonly IConversationSideCar _sidecar; private string _conversationId; /// /// States in the current round of conversation @@ -41,12 +40,10 @@ public class ConversationStateService : IConversationStateService, IDisposable public ConversationStateService( IServiceProvider services, IBotSharpRepository db, - IConversationSideCar sidecar, ILogger logger) { _services = services; _db = db; - _sidecar = sidecar; _logger = logger; _curStates = new ConversationState(); _historyStates = new ConversationState(); @@ -142,8 +139,9 @@ public class ConversationStateService : IConversationStateService, IDisposable _conversationId = !isReadOnly ? conversationId : null; Reset(); + var sidecar = _services.GetService(); var endNodes = new Dictionary(); - if (_sidecar?.IsEnabled() == true) + if (sidecar?.IsEnabled() == true) { return endNodes; } @@ -219,7 +217,8 @@ public class ConversationStateService : IConversationStateService, IDisposable public void Save() { - if (_conversationId == null || _sidecar?.IsEnabled() == true) + var sidecar = _services.GetService(); + if (_conversationId == null || sidecar?.IsEnabled() == true) { Reset(); return;