using BotSharp.Abstraction.Loggers.Models; using BotSharp.Abstraction.Plugins.Models; using BotSharp.Abstraction.Repositories.Filters; using BotSharp.Abstraction.Tasks.Models; using BotSharp.Abstraction.Translation.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) => throw new NotImplementedException(); User? GetUserById(string id) => throw new NotImplementedException(); User? GetUserByUserName(string userName) => throw new NotImplementedException(); void CreateUser(User user) => throw new NotImplementedException(); void UpdateUserVerified(string userId) => throw new NotImplementedException(); void UpdateUserVerificationCode(string userId, string verficationCode) => throw new NotImplementedException(); void UpdateUserPassword(string userId, string password) => throw new NotImplementedException(); #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(); bool DeleteAgent(string agentId); List GetAgentResponses(string agentId, string prefix, string intent); string GetAgentTemplate(string agentId, string templateName); bool PatchAgentTemplate(string agentId, AgentTemplate template); #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, List taskIds); bool DeleteAgentTasks(); #endregion #region Conversation void CreateNewConversation(Conversation conversation); bool DeleteConversations(IEnumerable conversationIds); List GetConversationDialogs(string conversationId); 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); void UpdateConversationBreakpoint(string conversationId, ConversationBreakpoint breakpoint); ConversationBreakpoint? GetConversationBreakpoint(string conversationId); List GetLastConversations(); List GetIdleConversations(int batchSize, int messageLimit, int bufferHours); IEnumerable 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 #region Translation IEnumerable GetTranslationMemories(IEnumerable queries); bool SaveTranslationMemories(IEnumerable inputs); #endregion }