refine side car
This commit is contained in:
parent
ef95e640ac
commit
796388a8fc
|
|
@ -9,6 +9,7 @@ public interface IConversationSideCar
|
|||
List<DialogElement> GetConversationDialogs(string conversationId);
|
||||
void UpdateConversationBreakpoint(string conversationId, ConversationBreakpoint breakpoint);
|
||||
ConversationBreakpoint? GetConversationBreakpoint(string conversationId);
|
||||
void UpdateConversationStates(string conversationId, List<StateKeyValue> states);
|
||||
Task<RoleDialogModel> SendMessage(string agentId, string text,
|
||||
PostbackMessageModel? postback = null, List<MessageState>? states = null, List<DialogElement>? dialogs = null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,6 +86,17 @@ public class BotSharpConversationSideCar : IConversationSideCar
|
|||
return top.LastOrDefault();
|
||||
}
|
||||
|
||||
public void UpdateConversationStates(string conversationId, List<StateKeyValue> states)
|
||||
{
|
||||
if (contextStack.IsNullOrEmpty() || _conversationId != conversationId)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var top = contextStack.Peek();
|
||||
top.State = new ConversationState(states);
|
||||
}
|
||||
|
||||
public async Task<RoleDialogModel> SendMessage(string agentId, string text,
|
||||
PostbackMessageModel? postback = null, List<MessageState>? states = null, List<DialogElement>? dialogs = null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -307,6 +307,7 @@ public partial class FileRepository
|
|||
return new ConversationState(states);
|
||||
}
|
||||
|
||||
[SideCar]
|
||||
public void UpdateConversationStates(string conversationId, List<StateKeyValue> states)
|
||||
{
|
||||
if (states.IsNullOrEmpty()) return;
|
||||
|
|
|
|||
|
|
@ -266,6 +266,7 @@ public partial class MongoRepository
|
|||
return new ConversationState(savedStates);
|
||||
}
|
||||
|
||||
[SideCar]
|
||||
public void UpdateConversationStates(string conversationId, List<StateKeyValue> states)
|
||||
{
|
||||
if (string.IsNullOrEmpty(conversationId) || states == null) return;
|
||||
|
|
|
|||
Loading…
Reference in a new issue