using BotSharp.Abstraction.Functions.Models; namespace BotSharp.Abstraction.Conversations; public interface IConversationHook { int Priority { get; } Agent Agent { get; } List Dialogs { get; } IConversationHook SetAgent(Agent agent); Conversation Conversation { get; } IConversationHook SetConversation(Conversation conversation); /// /// Triggered when user connects with agent first time. /// This hook is the good timing to show welcome infomation. /// /// /// Task OnUserAgentConnectedInitially(Conversation conversation); /// /// Triggered once for every new conversation. /// /// /// Task OnConversationInitialized(Conversation conversation); /// /// Triggered when dialog history is loaded. /// /// /// Task OnDialogsLoaded(List dialogs); /// /// Triggered when every dialog record is loaded /// It can be used to populate extra data point before presenting to user. /// /// /// Task OnDialogRecordLoaded(RoleDialogModel dialog); Task OnStateLoaded(ConversationState state); Task OnStateChanged(StateChangeModel stateChange); Task OnMessageReceived(RoleDialogModel message); Task OnPostbackMessageReceived(RoleDialogModel message, PostbackMessageModel replyMsg); /// /// Triggered before LLM calls function. /// /// /// Task OnFunctionExecuting(RoleDialogModel message); /// /// Triggered when the function calling completed. /// /// /// Task OnFunctionExecuted(RoleDialogModel message); Task OnResponseGenerated(RoleDialogModel message); /// /// LLM detected user requested a new task different from previous topic. /// /// /// Task OnNewTaskDetected(RoleDialogModel message, string reason); /// /// LLM detected the current task is completed. /// It's useful for the situation of multiple tasks in the same conversation. /// /// /// Task OnTaskCompleted(RoleDialogModel message); /// /// LLM detected the whole conversation is going to be end. /// /// /// Task OnConversationEnding(RoleDialogModel message); /// /// LLM can't handle user's request or user requests human being to involve. /// /// /// Task OnHumanInterventionNeeded(RoleDialogModel message); /// /// Delete message in a conversation /// /// /// /// Task OnMessageDeleted(string conversationId, string messageId); /// /// Brakpoint updated /// /// /// Task OnBreakpointUpdated(string conversationId, bool resetStates); }