Skip to content

optimize UpdateBreakPoint #472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Task<bool> SendMessage(string agentId,
/// </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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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>();
Expand All @@ -22,7 +22,13 @@ public async Task UpdateBreakpoint(bool resetStates = false, string? reason = nu
{
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>()
Expand Down