Merge pull request #791 from iceljc/master

init dialog in side car
This commit is contained in:
iceljc 2024-12-10 15:49:36 -06:00 committed by GitHub
commit 2253d72c47
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 6 deletions

View file

@ -9,5 +9,6 @@ public interface IConversationSideCar
List<DialogElement> GetConversationDialogs(string conversationId);
void UpdateConversationBreakpoint(string conversationId, ConversationBreakpoint breakpoint);
ConversationBreakpoint? GetConversationBreakpoint(string conversationId);
Task<RoleDialogModel> SendMessage(string agentId, string text, PostbackMessageModel? postback = null, List<MessageState>? states = null);
Task<RoleDialogModel> SendMessage(string agentId, string text,
PostbackMessageModel? postback = null, List<MessageState>? states = null, List<DialogElement>? dialogs = null);
}

View file

@ -80,9 +80,9 @@ public class BotSharpConversationSideCar : IConversationSideCar
}
public async Task<RoleDialogModel> SendMessage(string agentId, string text,
PostbackMessageModel? postback = null, List<MessageState>? states = null)
PostbackMessageModel? postback = null, List<MessageState>? states = null, List<DialogElement>? dialogs = null)
{
BeforeExecute();
BeforeExecute(dialogs);
var response = await InnerExecute(agentId, text, postback, states);
AfterExecute();
return response;
@ -114,7 +114,7 @@ public class BotSharpConversationSideCar : IConversationSideCar
return response;
}
private void BeforeExecute()
private void BeforeExecute(List<DialogElement>? dialogs)
{
enabled = true;
var state = _services.GetRequiredService<IConversationStateService>();
@ -123,8 +123,8 @@ public class BotSharpConversationSideCar : IConversationSideCar
var node = new ConversationContext
{
State = state.GetCurrentState(),
Dialogs = new(),
Breakpoints = new(),
Dialogs = dialogs ?? [],
Breakpoints = [],
RecursiveCounter = routing.Context.GetRecursiveCounter(),
RoutingStack = routing.Context.GetAgentStack()
};