Skip to content

Commit 6bd2af4

Browse files
committed
Remove IConversationSideCar dependency
1 parent cd0fa0e commit 6bd2af4

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ public class ConversationStateService : IConversationStateService, IDisposable
2727
private readonly ILogger _logger;
2828
private readonly IServiceProvider _services;
2929
private readonly IBotSharpRepository _db;
30-
private readonly IConversationSideCar _sidecar;
3130
private string _conversationId;
3231
/// <summary>
3332
/// States in the current round of conversation
@@ -41,12 +40,10 @@ public class ConversationStateService : IConversationStateService, IDisposable
4140
public ConversationStateService(
4241
IServiceProvider services,
4342
IBotSharpRepository db,
44-
IConversationSideCar sidecar,
4543
ILogger<ConversationStateService> logger)
4644
{
4745
_services = services;
4846
_db = db;
49-
_sidecar = sidecar;
5047
_logger = logger;
5148
_curStates = new ConversationState();
5249
_historyStates = new ConversationState();
@@ -142,8 +139,9 @@ public Dictionary<string, string> Load(string conversationId, bool isReadOnly =
142139
_conversationId = !isReadOnly ? conversationId : null;
143140
Reset();
144141

142+
var sidecar = _services.GetService<IConversationSideCar>();
145143
var endNodes = new Dictionary<string, string>();
146-
if (_sidecar?.IsEnabled() == true)
144+
if (sidecar?.IsEnabled() == true)
147145
{
148146
return endNodes;
149147
}
@@ -219,7 +217,8 @@ public Dictionary<string, string> Load(string conversationId, bool isReadOnly =
219217

220218
public void Save()
221219
{
222-
if (_conversationId == null || _sidecar?.IsEnabled() == true)
220+
var sidecar = _services.GetService<IConversationSideCar>();
221+
if (_conversationId == null || sidecar?.IsEnabled() == true)
223222
{
224223
Reset();
225224
return;

0 commit comments

Comments
 (0)