From f43c32b8662baf16b15690ea35ee3a026ceb6a62 Mon Sep 17 00:00:00 2001 From: Jicheng Lu <103353@smsassist.com> Date: Mon, 7 Jul 2025 17:29:25 -0500 Subject: [PATCH 1/3] revert to init --- .../Conversations/Services/ConversationStateService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs b/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs index ff61fde2a..c86651795 100644 --- a/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs +++ b/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs @@ -443,7 +443,7 @@ public ConversationState GetCurrentState() public void SetCurrentState(ConversationState state) { - var values = state.Values.ToList(); + var values = _curStates.Values.ToList(); var copy = JsonSerializer.Deserialize>(JsonSerializer.Serialize(values)); _curStates = new ConversationState(copy ?? []); } From ef1142f62ac11a886860b4284bf4c6066b9a7d48 Mon Sep 17 00:00:00 2001 From: Jicheng Lu <103353@smsassist.com> Date: Mon, 7 Jul 2025 17:41:39 -0500 Subject: [PATCH 2/3] refine --- .../Services/BotSharpConversationSideCar.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Infrastructure/BotSharp.Core.SideCar/Services/BotSharpConversationSideCar.cs b/src/Infrastructure/BotSharp.Core.SideCar/Services/BotSharpConversationSideCar.cs index 2d1fec734..e4996b067 100644 --- a/src/Infrastructure/BotSharp.Core.SideCar/Services/BotSharpConversationSideCar.cs +++ b/src/Infrastructure/BotSharp.Core.SideCar/Services/BotSharpConversationSideCar.cs @@ -167,13 +167,11 @@ private void BeforeExecute(List? dialogs) private void AfterExecute() { - var state = _services.GetRequiredService(); var routing = _services.GetRequiredService(); - var node = _contextStack.Pop(); // Recover - state.SetCurrentState(node.State); + RestoreStates(node.State); routing.Context.SetRecursiveCounter(node.RecursiveCounter); routing.Context.SetAgentStack(node.RoutingStack); routing.Context.SetDialogs(node.RoutingDialogs); From 9f7aa8f4d9e4674c052b93199398179d13d2862f Mon Sep 17 00:00:00 2001 From: Jicheng Lu <103353@smsassist.com> Date: Mon, 7 Jul 2025 17:43:17 -0500 Subject: [PATCH 3/3] revert --- .../Conversations/Services/ConversationStateService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs b/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs index c86651795..ff61fde2a 100644 --- a/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs +++ b/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs @@ -443,7 +443,7 @@ public ConversationState GetCurrentState() public void SetCurrentState(ConversationState state) { - var values = _curStates.Values.ToList(); + var values = state.Values.ToList(); var copy = JsonSerializer.Deserialize>(JsonSerializer.Serialize(values)); _curStates = new ConversationState(copy ?? []); }