using BotSharp.Abstraction.Loggers.Models; using BotSharp.Abstraction.Repositories.Filters; namespace BotSharp.Abstraction.Conversations; public interface IConversationService { IConversationStateService States { get; } string ConversationId { get; } Task NewConversation(Conversation conversation); void SetConversationId(string conversationId, List states, bool isReadOnly = false); Task GetConversation(string id); Task> GetConversations(ConversationFilter filter); Task UpdateConversationTitle(string id, string title); Task UpdateConversationTitleAlias(string id, string titleAlias); Task UpdateConversationTags(string conversationId, List tags); Task UpdateConversationMessage(string conversationId, UpdateMessageRequest request); Task> GetLastConversations(); Task> GetIdleConversations(int batchSize, int messageLimit, int bufferHours, IEnumerable excludeAgentIds); Task DeleteConversations(IEnumerable ids); /// /// Truncate conversation /// /// Target conversation id /// Target message id to delete /// If not null, delete messages while input a new message; otherwise delete messages only /// Task TruncateConversation(string conversationId, string messageId, string? newMessageId = null); Task> GetConversationContentLogs(string conversationId); Task> GetConversationStateLogs(string conversationId); /// /// Send message to LLM /// /// /// /// Received the response from AI Agent /// This delegate is useful when you want to report progress on UI /// This delegate is useful when you want to report progress on UI /// Task SendMessage(string agentId, RoleDialogModel lastDalog, PostbackMessageModel? replyMessage, Func onResponseReceived); List GetDialogHistory(int lastCount = 100, bool fromBreakpoint = true, IEnumerable? includeMessageTypes = null); Task CleanHistory(string agentId); /// /// Use this feature when you want to hide some context from LLM. /// /// Whether to reset all states /// Append user init words /// /// Task UpdateBreakpoint(bool resetStates = false, string? reason = null, params string[] excludedStates); Task GetConversationSummary(IEnumerable conversationId); Task GetConversationRecordOrCreateNew(string agentId); bool IsConversationMode(); void SaveStates(); /// /// Get conversation keys for searching /// /// search query /// conversation limit /// if pre-loading, then keys are not filter by the search query /// Task> GetConversationStateSearhKeys(string query, int convLimit = 100, int keyLimit = 10, bool preload = false); }