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;