Merge pull request #369 from iceljc/features/refine-breakpoint

fix cur message id
This commit is contained in:
C. Oceania 2024-03-27 22:25:38 -05:00 committed by GitHub
commit 714cbae6c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -118,7 +118,7 @@ public class ConversationStateService : IConversationStateService, IDisposable
state.Value.Values.Add(new StateValue state.Value.Values.Add(new StateValue
{ {
Data = value.Data, Data = value.Data,
MessageId = value.MessageId, MessageId = !string.IsNullOrEmpty(curMsgId) ? curMsgId : value.MessageId,
Active = false, Active = false,
ActiveRounds = value.ActiveRounds, ActiveRounds = value.ActiveRounds,
UpdateTime = DateTime.UtcNow UpdateTime = DateTime.UtcNow
@ -163,7 +163,10 @@ public class ConversationStateService : IConversationStateService, IDisposable
public void CleanStates() public void CleanStates()
{ {
var routingCtx = _services.GetRequiredService<IRoutingContext>();
var curMsgId = routingCtx.MessageId;
var utcNow = DateTime.UtcNow; var utcNow = DateTime.UtcNow;
foreach (var key in _states.Keys) foreach (var key in _states.Keys)
{ {
var value = _states[key]; var value = _states[key];
@ -175,7 +178,7 @@ public class ConversationStateService : IConversationStateService, IDisposable
value.Values.Add(new StateValue value.Values.Add(new StateValue
{ {
Data = lastValue.Data, Data = lastValue.Data,
MessageId = lastValue.MessageId, MessageId = !string.IsNullOrEmpty(curMsgId) ? curMsgId : lastValue.MessageId,
Active = false, Active = false,
ActiveRounds = lastValue.ActiveRounds, ActiveRounds = lastValue.ActiveRounds,
UpdateTime = utcNow UpdateTime = utcNow