resolve conflict

This commit is contained in:
Jicheng Lu 2024-05-27 12:15:44 -05:00
commit 6693c7cff2
2 changed files with 10 additions and 3 deletions

View file

@ -51,8 +51,9 @@ public interface IConversationService
/// </summary>
/// <param name="resetStates">Whether to reset all states</param>
/// <param name="reason">Append user init words</param>
/// <param name="excludedStates"></param>
/// <returns></returns>
Task UpdateBreakpoint(bool resetStates = false, string? reason = null);
Task UpdateBreakpoint(bool resetStates = false, string? reason = null, params string[] excludedStates);
Task<string> GetConversationSummary(string conversationId);
}

View file

@ -4,7 +4,7 @@ namespace BotSharp.Core.Conversations.Services;
public partial class ConversationService : IConversationService
{
public async Task UpdateBreakpoint(bool resetStates = false, string? reason = null)
public async Task UpdateBreakpoint(bool resetStates = false, string? reason = null, params string[] excludedStates)
{
var db = _services.GetRequiredService<IBotSharpRepository>();
var routingCtx = _services.GetRequiredService<IRoutingContext>();
@ -22,7 +22,13 @@ public partial class ConversationService : IConversationService
{
var states = _services.GetRequiredService<IConversationStateService>();
// keep language state
states.CleanStates(StateConst.LANGUAGE);
if (excludedStates == null) excludedStates = new string[] { };
if (!excludedStates.Contains(StateConst.LANGUAGE))
{
excludedStates = excludedStates.Append(StateConst.LANGUAGE).ToArray();
}
states.CleanStates(excludedStates);
}
var hooks = _services.GetServices<IConversationHook>()