optimize UpdateBreakpoint

This commit is contained in:
LAPTOP-3CFGGVOS\rabbit 2024-05-27 21:17:50 +08:00
parent 245384e8d2
commit ad7b3a41eb
2 changed files with 8 additions and 2 deletions

View file

@ -51,6 +51,7 @@ 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);
}

View file

@ -22,7 +22,12 @@ public partial class ConversationService : IConversationService
{
var states = _services.GetRequiredService<IConversationStateService>();
// keep language state
if(excludedStates.IsNullOrEmpty()) excludedStates = new string[] { StateConst.LANGUAGE };
if (excludedStates == null) excludedStates = new string[] { };
if (!excludedStates.Contains(StateConst.LANGUAGE))
{
excludedStates = excludedStates.Append(StateConst.LANGUAGE).ToArray();
}
states.CleanStates(excludedStates);
}