using BotSharp.Abstraction.Loggers.Models; using BotSharp.Abstraction.Plugins.Models; using BotSharp.Abstraction.Repositories.Filters; using BotSharp.Abstraction.Roles.Models; using BotSharp.Abstraction.Shared; using BotSharp.Abstraction.Statistics.Models; using BotSharp.Abstraction.Tasks.Models; using BotSharp.Abstraction.Translation.Models; using BotSharp.Abstraction.Users.Enums; using BotSharp.Abstraction.Users.Models; using BotSharp.Abstraction.VectorStorage.Models; namespace BotSharp.Abstraction.Repositories; public interface IBotSharpRepository : IHaveServiceProvider { #region Plugin PluginConfig GetPluginConfig(); void SavePluginConfig(PluginConfig config); #endregion #region Role bool RefreshRoles(IEnumerable roles) => throw new NotImplementedException(); IEnumerable GetRoles(RoleFilter filter) => throw new NotImplementedException(); Role? GetRoleDetails(string roleId, bool includeAgent = false) => throw new NotImplementedException(); bool UpdateRole(Role role, bool updateRoleAgents = false) => throw new NotImplementedException(); #endregion #region User User? GetUserByEmail(string email) => throw new NotImplementedException(); User? GetUserByPhone(string phone, string type = UserType.Client, string regionCode = "CN") => throw new NotImplementedException(); User? GetAffiliateUserByPhone(string phone) => throw new NotImplementedException(); User? GetUserById(string id) => throw new NotImplementedException(); List GetUserByIds(List ids) => throw new NotImplementedException(); List GetUsersByAffiliateId(string affiliateId) => throw new NotImplementedException(); User? GetUserByUserName(string userName) => throw new NotImplementedException(); void UpdateUserName(string userId, string userName) => throw new NotImplementedException(); Dashboard? GetDashboard(string id = null) => throw new NotImplementedException(); void CreateUser(User user) => throw new NotImplementedException(); void UpdateExistUser(string userId, User user) => throw new NotImplementedException(); void UpdateUserVerified(string userId) => throw new NotImplementedException(); void AddDashboardConversation(string userId, string conversationId) => throw new NotImplementedException(); void RemoveDashboardConversation(string userId, string conversationId) => throw new NotImplementedException(); void UpdateDashboardConversation(string userId, DashboardConversation dashConv) => throw new NotImplementedException(); void UpdateUserVerificationCode(string userId, string verficationCode) => throw new NotImplementedException(); void UpdateUserPassword(string userId, string password) => throw new NotImplementedException(); void UpdateUserEmail(string userId, string email) => throw new NotImplementedException(); void UpdateUserPhone(string userId, string Iphone, string regionCode) => throw new NotImplementedException(); void UpdateUserIsDisable(string userId, bool isDisable) => throw new NotImplementedException(); void UpdateUsersIsDisable(List userIds, bool isDisable) => throw new NotImplementedException(); PagedItems GetUsers(UserFilter filter) => throw new NotImplementedException(); User? GetUserDetails(string userId, bool includeAgent = false) => throw new NotImplementedException(); bool UpdateUser(User user, bool updateUserAgents = false) => throw new NotImplementedException(); #endregion #region Agent void UpdateAgent(Agent agent, AgentField field); Agent? GetAgent(string agentId, bool basicsOnly = false); List GetAgents(AgentFilter filter); List GetUserAgents(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 UpdateConversationTitleAlias(string conversationId, string titleAlias); bool UpdateConversationTags(string conversationId, List tags); bool AppendConversationTags(string conversationId, List tags); bool UpdateConversationMessage(string conversationId, UpdateMessageRequest request); void UpdateConversationBreakpoint(string conversationId, ConversationBreakpoint breakpoint); ConversationBreakpoint? GetConversationBreakpoint(string conversationId); List GetLastConversations(); List GetIdleConversations(int batchSize, int messageLimit, int bufferHours, IEnumerable excludeAgentIds); 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 BotSharpStats? GetGlobalStats(string category, string group, DateTime recordTime) => throw new NotImplementedException(); bool SaveGlobalStats(BotSharpStats body) => throw new NotImplementedException(); #endregion #region Translation IEnumerable GetTranslationMemories(IEnumerable queries); bool SaveTranslationMemories(IEnumerable inputs); #endregion #region KnowledgeBase /// /// Save knowledge collection configs. If reset is true, it will remove everything and then save the new configs. /// /// /// /// bool AddKnowledgeCollectionConfigs(List configs, bool reset = false); bool DeleteKnowledgeCollectionConfig(string collectionName); IEnumerable GetKnowledgeCollectionConfigs(VectorCollectionConfigFilter filter); bool SaveKnolwedgeBaseFileMeta(KnowledgeDocMetaData metaData); /// /// Delete file meta data in a knowledge collection, given the vector store provider. If "fileId" is null, delete all in the collection. /// /// /// /// /// bool DeleteKnolwedgeBaseFileMeta(string collectionName, string vectorStoreProvider, Guid? fileId = null); PagedItems GetKnowledgeBaseFileMeta(string collectionName, string vectorStoreProvider, KnowledgeFileFilter filter); #endregion #region Crontab bool UpsertCrontabItem(CrontabItem cron) => throw new NotImplementedException(); bool DeleteCrontabItem(string conversationId) => throw new NotImplementedException(); PagedItems GetCrontabItems(CrontabItemFilter filter) => throw new NotImplementedException(); #endregion }