refine code
This commit is contained in:
parent
805dc63ea8
commit
07ee8fcf2f
|
|
@ -7,5 +7,5 @@ public interface IConversationSideCar
|
||||||
List<DialogElement> GetConversationDialogs(string conversationId);
|
List<DialogElement> GetConversationDialogs(string conversationId);
|
||||||
void UpdateConversationBreakpoint(string conversationId, ConversationBreakpoint breakpoint);
|
void UpdateConversationBreakpoint(string conversationId, ConversationBreakpoint breakpoint);
|
||||||
ConversationBreakpoint? GetConversationBreakpoint(string conversationId);
|
ConversationBreakpoint? GetConversationBreakpoint(string conversationId);
|
||||||
Task<RoleDialogModel> Execute(string conversationId, string agentId, string text, PostbackMessageModel? postback = null, List<MessageState>? states = null);
|
Task<RoleDialogModel> Execute(string agentId, string text, PostbackMessageModel? postback = null, List<MessageState>? states = null);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ public interface IRoutingContext
|
||||||
|
|
||||||
int CurrentRecursionDepth { get; }
|
int CurrentRecursionDepth { get; }
|
||||||
int GetRecursiveCounter();
|
int GetRecursiveCounter();
|
||||||
int IncreaseRecursiveCounter();
|
void IncreaseRecursiveCounter();
|
||||||
void SetRecursiveCounter(int counter);
|
void SetRecursiveCounter(int counter);
|
||||||
void ResetRecursiveCounter();
|
void ResetRecursiveCounter();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ public class ConversationSideCar : IConversationSideCar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<RoleDialogModel> Execute(string conversationId, string agentId, string text,
|
public async Task<RoleDialogModel> Execute(string agentId, string text,
|
||||||
PostbackMessageModel? postback = null, List<MessageState>? states = null)
|
PostbackMessageModel? postback = null, List<MessageState>? states = null)
|
||||||
{
|
{
|
||||||
BeforeExecute();
|
BeforeExecute();
|
||||||
|
|
|
||||||
|
|
@ -394,7 +394,9 @@ public class ConversationStateService : IConversationStateService, IDisposable
|
||||||
|
|
||||||
public void SetCurrentState(ConversationState state)
|
public void SetCurrentState(ConversationState state)
|
||||||
{
|
{
|
||||||
_curStates = state;
|
var values = _curStates.Values.ToList();
|
||||||
|
var copy = JsonSerializer.Deserialize<List<StateKeyValue>>(JsonSerializer.Serialize(values));
|
||||||
|
_curStates = new ConversationState(copy ?? new());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetCurrentState()
|
public void ResetCurrentState()
|
||||||
|
|
|
||||||
|
|
@ -214,9 +214,9 @@ public class RoutingContext : IRoutingContext
|
||||||
return _currentRecursionDepth;
|
return _currentRecursionDepth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int IncreaseRecursiveCounter()
|
public void IncreaseRecursiveCounter()
|
||||||
{
|
{
|
||||||
return _currentRecursionDepth;
|
_currentRecursionDepth++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetRecursiveCounter(int counter)
|
public void SetRecursiveCounter(int counter)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue