using BotSharp.Abstraction.Loggers.Models; using BotSharp.Abstraction.Plugins.Models; using BotSharp.Abstraction.Repositories.Filters; using BotSharp.Abstraction.Repositories.Models; using BotSharp.Abstraction.Tasks.Models; using BotSharp.Abstraction.Users.Models; namespace BotSharp.Abstraction.Repositories; public interface IBotSharpRepository { int Transaction(Action action); void Add(object entity); #region Plugin PluginConfig GetPluginConfig(); void SavePluginConfig(PluginConfig config); #endregion #region User User? GetUserByEmail(string email); User? GetUserById(string id); User? GetUserByUserName(string userName); void CreateUser(User user); #endregion #region Agent void UpdateAgent(Agent agent, AgentField field); Agent? GetAgent(string agentId); List GetAgents(AgentFilter filter); List GetAgentsByUser(string userId); void BulkInsertAgents(List agents); void BulkInsertUserAgents(List userAgents); bool DeleteAgents(); List GetAgentResponses(string agentId, string prefix, string intent); string GetAgentTemplate(string agentId, string templateName); #endregion #region Agent Task PagedItems GetAgentTasks(AgentTaskFilter filter); AgentTask? GetAgentTask(string agentId, string taskId); void InsertAgentTask(AgentTask task); void BulkInsertAgentTasks(List tasks); void UpdateAgentTask(AgentTask task, AgentTaskField field); bool DeleteAgentTask(string agentId, string taskId); bool DeleteAgentTasks(); #endregion #region Conversation void CreateNewConversation(Conversation conversation); bool DeleteConversations(IEnumerable conversationIds); List GetConversationDialogs(string conversationId); void UpdateConversationDialogElements(string conversationId, List updateElements); void AppendConversationDialogs(string conversationId, List dialogs); ConversationState GetConversationStates(string conversationId); void UpdateConversationStates(string conversationId, List states); void UpdateConversationStatus(string conversationId, string status); Conversation GetConversation(string conversationId); PagedItems GetConversations(ConversationFilter filter); void UpdateConversationTitle(string conversationId, string title); List GetLastConversations(); List GetIdleConversations(int batchSize, int messageLimit); bool TruncateConversation(string conversationId, string messageId, bool cleanLog = false); #endregion #region Execution Log void AddExecutionLogs(string conversationId, List logs); List GetExecutionLogs(string conversationId); #endregion #region LLM Completion Log void SaveLlmCompletionLog(LlmCompletionLog log); #endregion #region Conversation Content Log void SaveConversationContentLog(ContentLogOutputModel log); List GetConversationContentLogs(string conversationId); #endregion #region Conversation State Log void SaveConversationStateLog(ConversationStateLogModel log); List GetConversationStateLogs(string conversationId); #endregion #region Statistics void IncrementConversationCount(); #endregion }