Skip to content

Commit 450ac21

Browse files
author
Jicheng Lu
committed
Merge branch 'master' of https://github.com/SciSharp/BotSharp into features/refine-streaming-message
2 parents e52da50 + 9b74463 commit 450ac21

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public class ConversationStateService : IConversationStateService
3838
/// States in the previous rounds of conversation
3939
/// </summary>
4040
private ConversationState _historyStates;
41+
private bool _isReadOnly;
4142

4243
public ConversationStateService(
4344
IServiceProvider services,
@@ -153,7 +154,8 @@ public IConversationStateService SetState<T>(string name, T value, bool isNeedVe
153154

154155
public async Task<Dictionary<string, string>> Load(string conversationId, bool isReadOnly = false)
155156
{
156-
_conversationId = !isReadOnly ? conversationId : null;
157+
_isReadOnly = isReadOnly;
158+
_conversationId = conversationId;
157159
Reset();
158160

159161
var endNodes = new Dictionary<string, string>();
@@ -232,7 +234,7 @@ public async Task<Dictionary<string, string>> Load(string conversationId, bool i
232234

233235
public async Task Save()
234236
{
235-
if (_conversationId == null || _sidecar?.IsEnabled == true)
237+
if (_conversationId == null || _sidecar?.IsEnabled == true || _isReadOnly)
236238
{
237239
return;
238240
}

0 commit comments

Comments
 (0)