optimize UpdateBreakpoint
This commit is contained in:
parent
245384e8d2
commit
ad7b3a41eb
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue