2024-02-15 20:43:36 +00:00
|
|
|
using BotSharp.Abstraction.Loggers.Models;
|
2024-01-12 22:20:22 +00:00
|
|
|
using BotSharp.Abstraction.Plugins.Models;
|
2023-11-27 22:20:49 +00:00
|
|
|
using BotSharp.Abstraction.Repositories.Filters;
|
2024-11-13 23:16:49 +00:00
|
|
|
using BotSharp.Abstraction.Roles.Models;
|
2024-11-04 22:44:41 +00:00
|
|
|
using BotSharp.Abstraction.Shared;
|
2025-01-24 05:45:43 +00:00
|
|
|
using BotSharp.Abstraction.Statistics.Models;
|
2024-02-04 05:42:13 +00:00
|
|
|
using BotSharp.Abstraction.Tasks.Models;
|
2024-06-14 20:39:56 +00:00
|
|
|
using BotSharp.Abstraction.Translation.Models;
|
2024-11-25 11:14:08 +00:00
|
|
|
using BotSharp.Abstraction.Users.Enums;
|
2023-09-07 22:04:34 +00:00
|
|
|
using BotSharp.Abstraction.Users.Models;
|
2024-09-09 16:32:31 +00:00
|
|
|
using BotSharp.Abstraction.VectorStorage.Models;
|
2023-08-26 04:41:01 +00:00
|
|
|
|
|
|
|
|
namespace BotSharp.Abstraction.Repositories;
|
2023-08-10 04:53:22 +00:00
|
|
|
|
2024-11-04 22:44:41 +00:00
|
|
|
public interface IBotSharpRepository : IHaveServiceProvider
|
2023-08-10 04:53:22 +00:00
|
|
|
{
|
2024-01-12 22:20:22 +00:00
|
|
|
#region Plugin
|
2024-09-29 11:26:17 +00:00
|
|
|
PluginConfig GetPluginConfig();
|
2024-01-12 22:20:22 +00:00
|
|
|
void SavePluginConfig(PluginConfig config);
|
|
|
|
|
#endregion
|
|
|
|
|
|
2024-11-13 23:16:49 +00:00
|
|
|
#region Role
|
2024-11-14 23:33:26 +00:00
|
|
|
bool RefreshRoles(IEnumerable<Role> roles) => throw new NotImplementedException();
|
2024-11-13 23:16:49 +00:00
|
|
|
IEnumerable<Role> GetRoles(RoleFilter filter) => throw new NotImplementedException();
|
2024-11-14 23:33:26 +00:00
|
|
|
Role? GetRoleDetails(string roleId, bool includeAgent = false) => throw new NotImplementedException();
|
|
|
|
|
bool UpdateRole(Role role, bool updateRoleAgents = false) => throw new NotImplementedException();
|
2024-11-13 23:16:49 +00:00
|
|
|
#endregion
|
|
|
|
|
|
2023-09-15 20:19:44 +00:00
|
|
|
#region User
|
2024-05-26 01:34:29 +00:00
|
|
|
User? GetUserByEmail(string email) => throw new NotImplementedException();
|
2024-11-25 11:14:08 +00:00
|
|
|
User? GetUserByPhone(string phone, string type = UserType.Client, string regionCode = "CN") => throw new NotImplementedException();
|
2024-09-21 07:12:08 +00:00
|
|
|
User? GetAffiliateUserByPhone(string phone) => throw new NotImplementedException();
|
2024-09-29 11:26:17 +00:00
|
|
|
User? GetUserById(string id) => throw new NotImplementedException();
|
2024-09-21 07:12:08 +00:00
|
|
|
List<User> GetUserByIds(List<string> ids) => throw new NotImplementedException();
|
2024-10-19 09:16:55 +00:00
|
|
|
List<User> GetUsersByAffiliateId(string affiliateId) => throw new NotImplementedException();
|
2024-12-16 01:58:57 +00:00
|
|
|
User? GetUserByUserName(string userName) => throw new NotImplementedException();
|
2024-12-16 13:59:12 +00:00
|
|
|
void UpdateUserName(string userId, string userName) => throw new NotImplementedException();
|
2024-11-07 15:12:10 +00:00
|
|
|
Dashboard? GetDashboard(string id = null) => throw new NotImplementedException();
|
2024-05-26 01:34:29 +00:00
|
|
|
void CreateUser(User user) => throw new NotImplementedException();
|
2024-10-11 11:58:54 +00:00
|
|
|
void UpdateExistUser(string userId, User user) => throw new NotImplementedException();
|
2024-05-26 01:34:29 +00:00
|
|
|
void UpdateUserVerified(string userId) => throw new NotImplementedException();
|
2024-11-07 15:12:10 +00:00
|
|
|
void AddDashboardConversation(string userId, string conversationId) => throw new NotImplementedException();
|
2024-11-21 19:07:00 +00:00
|
|
|
void RemoveDashboardConversation(string userId, string conversationId) => throw new NotImplementedException();
|
|
|
|
|
void UpdateDashboardConversation(string userId, DashboardConversation dashConv) => throw new NotImplementedException();
|
2024-06-28 09:59:49 +00:00
|
|
|
void UpdateUserVerificationCode(string userId, string verficationCode) => throw new NotImplementedException();
|
|
|
|
|
void UpdateUserPassword(string userId, string password) => throw new NotImplementedException();
|
2024-09-29 11:26:17 +00:00
|
|
|
void UpdateUserEmail(string userId, string email) => throw new NotImplementedException();
|
2024-10-22 10:43:34 +00:00
|
|
|
void UpdateUserPhone(string userId, string Iphone, string regionCode) => throw new NotImplementedException();
|
2024-09-21 07:12:08 +00:00
|
|
|
void UpdateUserIsDisable(string userId, bool isDisable) => throw new NotImplementedException();
|
2024-09-29 11:26:17 +00:00
|
|
|
void UpdateUsersIsDisable(List<string> userIds, bool isDisable) => throw new NotImplementedException();
|
2024-10-31 19:36:26 +00:00
|
|
|
PagedItems<User> GetUsers(UserFilter filter) => throw new NotImplementedException();
|
2024-11-14 23:33:26 +00:00
|
|
|
User? GetUserDetails(string userId, bool includeAgent = false) => throw new NotImplementedException();
|
|
|
|
|
bool UpdateUser(User user, bool updateUserAgents = false) => throw new NotImplementedException();
|
2024-12-12 12:58:22 +00:00
|
|
|
|
2023-09-15 20:19:44 +00:00
|
|
|
#endregion
|
2023-09-03 04:54:22 +00:00
|
|
|
|
2023-09-15 20:19:44 +00:00
|
|
|
#region Agent
|
|
|
|
|
void UpdateAgent(Agent agent, AgentField field);
|
2024-12-13 20:34:17 +00:00
|
|
|
Agent? GetAgent(string agentId, bool basicsOnly = false);
|
2023-11-27 22:20:49 +00:00
|
|
|
List<Agent> GetAgents(AgentFilter filter);
|
2024-10-31 19:36:26 +00:00
|
|
|
List<UserAgent> GetUserAgents(string userId);
|
2023-10-17 20:29:40 +00:00
|
|
|
void BulkInsertAgents(List<Agent> agents);
|
|
|
|
|
void BulkInsertUserAgents(List<UserAgent> userAgents);
|
|
|
|
|
bool DeleteAgents();
|
2024-04-11 07:00:17 +00:00
|
|
|
bool DeleteAgent(string agentId);
|
2023-09-09 20:13:19 +00:00
|
|
|
List<string> GetAgentResponses(string agentId, string prefix, string intent);
|
2023-09-15 20:19:44 +00:00
|
|
|
string GetAgentTemplate(string agentId, string templateName);
|
2024-05-09 22:06:03 +00:00
|
|
|
bool PatchAgentTemplate(string agentId, AgentTemplate template);
|
2023-09-15 20:19:44 +00:00
|
|
|
#endregion
|
2023-09-03 22:43:50 +00:00
|
|
|
|
2024-02-04 05:42:13 +00:00
|
|
|
#region Agent Task
|
|
|
|
|
PagedItems<AgentTask> GetAgentTasks(AgentTaskFilter filter);
|
|
|
|
|
AgentTask? GetAgentTask(string agentId, string taskId);
|
|
|
|
|
void InsertAgentTask(AgentTask task);
|
2024-02-05 20:53:18 +00:00
|
|
|
void BulkInsertAgentTasks(List<AgentTask> tasks);
|
2024-02-04 20:01:56 +00:00
|
|
|
void UpdateAgentTask(AgentTask task, AgentTaskField field);
|
2024-04-11 07:00:17 +00:00
|
|
|
bool DeleteAgentTask(string agentId, List<string> taskIds);
|
2024-02-05 20:53:18 +00:00
|
|
|
bool DeleteAgentTasks();
|
2024-02-04 05:42:13 +00:00
|
|
|
#endregion
|
|
|
|
|
|
2023-09-15 20:19:44 +00:00
|
|
|
#region Conversation
|
2023-09-07 22:04:34 +00:00
|
|
|
void CreateNewConversation(Conversation conversation);
|
2024-03-07 07:34:52 +00:00
|
|
|
bool DeleteConversations(IEnumerable<string> conversationIds);
|
2023-11-22 00:16:45 +00:00
|
|
|
List<DialogElement> GetConversationDialogs(string conversationId);
|
|
|
|
|
void AppendConversationDialogs(string conversationId, List<DialogElement> dialogs);
|
2024-01-02 17:50:07 +00:00
|
|
|
ConversationState GetConversationStates(string conversationId);
|
2024-01-02 17:40:08 +00:00
|
|
|
void UpdateConversationStates(string conversationId, List<StateKeyValue> states);
|
2023-11-15 18:35:24 +00:00
|
|
|
void UpdateConversationStatus(string conversationId, string status);
|
2023-09-07 22:04:34 +00:00
|
|
|
Conversation GetConversation(string conversationId);
|
2024-01-18 05:23:20 +00:00
|
|
|
PagedItems<Conversation> GetConversations(ConversationFilter filter);
|
2023-11-22 05:07:19 +00:00
|
|
|
void UpdateConversationTitle(string conversationId, string title);
|
2024-12-12 03:28:00 +00:00
|
|
|
void UpdateConversationTitleAlias(string conversationId, string titleAlias);
|
2024-10-18 20:50:39 +00:00
|
|
|
bool UpdateConversationTags(string conversationId, List<string> tags);
|
2025-01-13 07:14:36 +00:00
|
|
|
bool AppendConversationTags(string conversationId, List<string> tags);
|
2024-10-11 20:07:41 +00:00
|
|
|
bool UpdateConversationMessage(string conversationId, UpdateMessageRequest request);
|
2024-04-08 03:15:51 +00:00
|
|
|
void UpdateConversationBreakpoint(string conversationId, ConversationBreakpoint breakpoint);
|
|
|
|
|
ConversationBreakpoint? GetConversationBreakpoint(string conversationId);
|
2023-11-10 16:01:03 +00:00
|
|
|
List<Conversation> GetLastConversations();
|
2024-09-09 17:26:26 +00:00
|
|
|
List<string> GetIdleConversations(int batchSize, int messageLimit, int bufferHours, IEnumerable<string> excludeAgentIds);
|
2024-05-06 22:31:52 +00:00
|
|
|
IEnumerable<string> TruncateConversation(string conversationId, string messageId, bool cleanLog = false);
|
2023-11-29 23:23:14 +00:00
|
|
|
#endregion
|
2024-09-29 11:26:17 +00:00
|
|
|
|
2023-11-29 23:23:14 +00:00
|
|
|
#region Execution Log
|
2023-11-29 16:21:03 +00:00
|
|
|
void AddExecutionLogs(string conversationId, List<string> logs);
|
|
|
|
|
List<string> GetExecutionLogs(string conversationId);
|
2023-09-15 20:19:44 +00:00
|
|
|
#endregion
|
2023-11-27 23:49:24 +00:00
|
|
|
|
|
|
|
|
#region LLM Completion Log
|
|
|
|
|
void SaveLlmCompletionLog(LlmCompletionLog log);
|
|
|
|
|
#endregion
|
2024-02-04 05:42:13 +00:00
|
|
|
|
2024-02-15 20:43:36 +00:00
|
|
|
#region Conversation Content Log
|
2024-03-01 02:50:39 +00:00
|
|
|
void SaveConversationContentLog(ContentLogOutputModel log);
|
|
|
|
|
List<ContentLogOutputModel> GetConversationContentLogs(string conversationId);
|
2024-02-15 20:43:36 +00:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Conversation State Log
|
|
|
|
|
void SaveConversationStateLog(ConversationStateLogModel log);
|
|
|
|
|
List<ConversationStateLogModel> GetConversationStateLogs(string conversationId);
|
|
|
|
|
#endregion
|
|
|
|
|
|
2024-02-04 05:42:13 +00:00
|
|
|
#region Statistics
|
2025-01-28 16:56:45 +00:00
|
|
|
BotSharpStats? GetGlobalStats(string metric, string dimension, DateTime recordTime) => throw new NotImplementedException();
|
2025-01-24 05:45:43 +00:00
|
|
|
bool SaveGlobalStats(BotSharpStats body) => throw new NotImplementedException();
|
|
|
|
|
|
2024-02-04 05:42:13 +00:00
|
|
|
#endregion
|
2024-06-14 20:39:56 +00:00
|
|
|
|
|
|
|
|
#region Translation
|
|
|
|
|
IEnumerable<TranslationMemoryOutput> GetTranslationMemories(IEnumerable<TranslationMemoryQuery> queries);
|
|
|
|
|
bool SaveTranslationMemories(IEnumerable<TranslationMemoryInput> inputs);
|
|
|
|
|
|
|
|
|
|
#endregion
|
2024-09-09 16:32:31 +00:00
|
|
|
|
2024-09-10 19:02:25 +00:00
|
|
|
#region KnowledgeBase
|
2024-09-09 19:16:09 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// Save knowledge collection configs. If reset is true, it will remove everything and then save the new configs.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="configs"></param>
|
|
|
|
|
/// <param name="reset"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
bool AddKnowledgeCollectionConfigs(List<VectorCollectionConfig> configs, bool reset = false);
|
|
|
|
|
bool DeleteKnowledgeCollectionConfig(string collectionName);
|
|
|
|
|
IEnumerable<VectorCollectionConfig> GetKnowledgeCollectionConfigs(VectorCollectionConfigFilter filter);
|
2024-09-17 17:50:39 +00:00
|
|
|
bool SaveKnolwedgeBaseFileMeta(KnowledgeDocMetaData metaData);
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Delete file meta data in a knowledge collection, given the vector store provider. If "fileId" is null, delete all in the collection.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="collectionName"></param>
|
|
|
|
|
/// <param name="vectorStoreProvider"></param>
|
|
|
|
|
/// <param name="fileId"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
bool DeleteKnolwedgeBaseFileMeta(string collectionName, string vectorStoreProvider, Guid? fileId = null);
|
|
|
|
|
PagedItems<KnowledgeDocMetaData> GetKnowledgeBaseFileMeta(string collectionName, string vectorStoreProvider, KnowledgeFileFilter filter);
|
2024-09-09 16:32:31 +00:00
|
|
|
#endregion
|
2024-12-09 00:29:04 +00:00
|
|
|
|
|
|
|
|
#region Crontab
|
2024-12-10 21:16:03 +00:00
|
|
|
bool UpsertCrontabItem(CrontabItem cron) => throw new NotImplementedException();
|
|
|
|
|
bool DeleteCrontabItem(string conversationId) => throw new NotImplementedException();
|
2024-12-09 00:29:04 +00:00
|
|
|
PagedItems<CrontabItem> GetCrontabItems(CrontabItemFilter filter) => throw new NotImplementedException();
|
|
|
|
|
#endregion
|
2023-08-10 04:53:22 +00:00
|
|
|
}
|