From 50d1c43cf07ffefb8112a619760dc18dd6709d05 Mon Sep 17 00:00:00 2001 From: Jicheng Lu <103353@smsassist.com> Date: Tue, 26 Mar 2024 17:09:49 -0500 Subject: [PATCH] minor change --- .../Conversations/Models/StateKeyValue.cs | 3 +++ .../Conversations/Services/ConversationStateService.cs | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Infrastructure/BotSharp.Abstraction/Conversations/Models/StateKeyValue.cs b/src/Infrastructure/BotSharp.Abstraction/Conversations/Models/StateKeyValue.cs index 1c37ddc9..18253192 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Conversations/Models/StateKeyValue.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Conversations/Models/StateKeyValue.cs @@ -21,9 +21,12 @@ public class StateKeyValue public class StateValue { public string Data { get; set; } + [JsonPropertyName("message_id")] public string MessageId { get; set; } + public bool Active { get; set; } + [JsonPropertyName("update_time")] public DateTime UpdateTime { get; set; } diff --git a/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs b/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs index a594dd14..1bea562c 100644 --- a/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs +++ b/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs @@ -145,8 +145,13 @@ public class ConversationStateService : IConversationStateService, IDisposable var lastValue = value.Values.LastOrDefault(); if (lastValue == null || !lastValue.Active) continue; - lastValue.Active = false; - lastValue.UpdateTime = utcNow; + value.Values.Add(new StateValue + { + Data = lastValue.Data, + MessageId = lastValue.MessageId, + Active = false, + UpdateTime = utcNow + }); } }