BotSharp/src/Infrastructure/BotSharp.Abstraction/Repositories/IBotSharpRepository.cs

253 lines
13 KiB
C#
Raw Normal View History

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-28 22:46:59 +00:00
using BotSharp.Abstraction.Statistics.Enums;
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;
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
2025-01-30 17:14:52 +00:00
PluginConfig GetPluginConfig()
=> throw new NotImplementedException();
void SavePluginConfig(PluginConfig config)
=> throw new NotImplementedException();
2024-01-12 22:20:22 +00:00
#endregion
2024-11-13 23:16:49 +00:00
#region Role
2025-01-30 17:14:52 +00:00
bool RefreshRoles(IEnumerable<Role> roles)
=> throw new NotImplementedException();
IEnumerable<Role> 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();
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();
User? GetUserByPhone(string phone, string type = UserType.Client, string regionCode = "CN") => throw new NotImplementedException();
User? GetUserByPhoneV2(string phone, string source = UserType.Internal, 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();
Dashboard? GetDashboard(string id = null) => throw new NotImplementedException();
2024-05-26 01:34:29 +00:00
void CreateUser(User user) => throw new NotImplementedException();
void UpdateExistUser(string userId, User user) => throw new NotImplementedException();
2024-05-26 01:34:29 +00:00
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();
2024-09-29 11:26:17 +00:00
void UpdateUserEmail(string userId, string email) => throw new NotImplementedException();
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();
2025-08-11 20:46:35 +00:00
ValueTask<PagedItems<User>> GetUsers(UserFilter filter) => throw new NotImplementedException();
2025-01-20 11:44:33 +00:00
List<User> SearchLoginUsers(User filter, string source = UserSource.Internal) =>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();
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
2025-01-30 17:14:52 +00:00
void UpdateAgent(Agent agent, AgentField field)
=> throw new NotImplementedException();
Agent? GetAgent(string agentId, bool basicsOnly = false)
=> throw new NotImplementedException();
List<Agent> GetAgents(AgentFilter filter)
=> throw new NotImplementedException();
List<UserAgent> GetUserAgents(string userId)
=> throw new NotImplementedException();
void BulkInsertAgents(List<Agent> agents)
=> throw new NotImplementedException();
void BulkInsertUserAgents(List<UserAgent> userAgents)
=> throw new NotImplementedException();
bool DeleteAgents()
=> throw new NotImplementedException();
bool DeleteAgent(string agentId)
=> throw new NotImplementedException();
List<string> GetAgentResponses(string agentId, string prefix, string intent)
=> throw new NotImplementedException();
string GetAgentTemplate(string agentId, string templateName)
=> throw new NotImplementedException();
bool PatchAgentTemplate(string agentId, AgentTemplate template)
=> throw new NotImplementedException();
bool UpdateAgentLabels(string agentId, List<string> labels)
=> throw new NotImplementedException();
bool AppendAgentLabels(string agentId, List<string> labels)
=> throw new NotImplementedException();
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
2025-08-11 20:46:35 +00:00
ValueTask<PagedItems<AgentTask>> GetAgentTasks(AgentTaskFilter filter)
2025-01-30 17:14:52 +00:00
=> throw new NotImplementedException();
AgentTask? GetAgentTask(string agentId, string taskId)
=> throw new NotImplementedException();
void InsertAgentTask(AgentTask task)
=> throw new NotImplementedException();
2025-09-30 22:28:35 +00:00
void BulkInsertAgentTasks(string agentId, List<AgentTask> tasks)
2025-01-30 17:14:52 +00:00
=> throw new NotImplementedException();
void UpdateAgentTask(AgentTask task, AgentTaskField field)
=> throw new NotImplementedException();
2025-09-30 22:28:35 +00:00
bool DeleteAgentTasks(string agentId, List<string>? taskIds = null)
2025-01-30 17:14:52 +00:00
=> throw new NotImplementedException();
2024-02-04 05:42:13 +00:00
#endregion
2025-09-30 20:26:32 +00:00
#region Agent Code
2025-09-30 22:28:35 +00:00
List<AgentCodeScript> GetAgentCodeScripts(string agentId, List<string>? scriptNames = null)
=> throw new NotImplementedException();
2025-09-30 20:26:32 +00:00
string? GetAgentCodeScript(string agentId, string scriptName)
=> throw new NotImplementedException();
2025-09-30 22:28:35 +00:00
bool UpdateAgentCodeScript(string agentId, AgentCodeScript script)
=> throw new NotImplementedException();
bool BulkInsertAgentCodeScripts(string agentId, List<AgentCodeScript> scripts)
=> throw new NotImplementedException();
bool DeleteAgentCodeScripts(string agentId, List<string>? scriptNames)
2025-09-30 20:26:32 +00:00
=> throw new NotImplementedException();
#endregion
2023-09-15 20:19:44 +00:00
#region Conversation
2025-01-30 17:14:52 +00:00
void CreateNewConversation(Conversation conversation)
=> throw new NotImplementedException();
bool DeleteConversations(IEnumerable<string> conversationIds)
=> throw new NotImplementedException();
List<DialogElement> GetConversationDialogs(string conversationId)
=> throw new NotImplementedException();
void AppendConversationDialogs(string conversationId, List<DialogElement> dialogs)
=> throw new NotImplementedException();
ConversationState GetConversationStates(string conversationId)
=> throw new NotImplementedException();
void UpdateConversationStates(string conversationId, List<StateKeyValue> states)
=> throw new NotImplementedException();
void UpdateConversationStatus(string conversationId, string status)
=> throw new NotImplementedException();
2025-03-14 22:04:54 +00:00
Conversation GetConversation(string conversationId, bool isLoadStates = false)
2025-01-30 17:14:52 +00:00
=> throw new NotImplementedException();
2025-08-11 20:46:35 +00:00
ValueTask<PagedItems<Conversation>> GetConversations(ConversationFilter filter)
2025-01-30 17:14:52 +00:00
=> throw new NotImplementedException();
void UpdateConversationTitle(string conversationId, string title)
=> throw new NotImplementedException();
void UpdateConversationTitleAlias(string conversationId, string titleAlias)
=> throw new NotImplementedException();
2025-03-13 18:06:00 +00:00
bool UpdateConversationTags(string conversationId, List<string> toAddTags, List<string> toDeleteTags)
2025-01-30 17:14:52 +00:00
=> throw new NotImplementedException();
bool AppendConversationTags(string conversationId, List<string> tags)
=> throw new NotImplementedException();
bool UpdateConversationMessage(string conversationId, UpdateMessageRequest request)
=> throw new NotImplementedException();
void UpdateConversationBreakpoint(string conversationId, ConversationBreakpoint breakpoint)
=> throw new NotImplementedException();
ConversationBreakpoint? GetConversationBreakpoint(string conversationId)
=> throw new NotImplementedException();
List<Conversation> GetLastConversations()
=> throw new NotImplementedException();
List<string> GetIdleConversations(int batchSize, int messageLimit, int bufferHours, IEnumerable<string> excludeAgentIds)
=> throw new NotImplementedException();
2025-02-11 20:27:53 +00:00
List<string> TruncateConversation(string conversationId, string messageId, bool cleanLog = false)
=> throw new NotImplementedException();
2025-03-10 17:14:44 +00:00
List<string> GetConversationStateSearchKeys(ConversationStateKeysFilter filter)
2025-01-30 17:14:52 +00:00
=> throw new NotImplementedException();
2025-03-06 22:46:38 +00:00
List<string> GetConversationsToMigrate(int batchSize = 100)
=> throw new NotImplementedException();
bool MigrateConvsersationLatestStates(string conversationId)
=> throw new NotImplementedException();
2023-11-29 23:23:14 +00:00
#endregion
2024-09-29 11:26:17 +00:00
2023-11-27 23:49:24 +00:00
#region LLM Completion Log
2025-01-30 17:14:52 +00:00
void SaveLlmCompletionLog(LlmCompletionLog log)
=> throw new NotImplementedException();
2023-11-27 23:49:24 +00:00
#endregion
2024-02-04 05:42:13 +00:00
2024-02-15 20:43:36 +00:00
#region Conversation Content Log
2025-01-30 17:14:52 +00:00
void SaveConversationContentLog(ContentLogOutputModel log)
=> throw new NotImplementedException();
2025-03-12 15:13:57 +00:00
DateTimePagination<ContentLogOutputModel> GetConversationContentLogs(string conversationId, ConversationLogFilter filter)
2025-01-30 17:14:52 +00:00
=> throw new NotImplementedException();
2024-02-15 20:43:36 +00:00
#endregion
#region Conversation State Log
2025-01-30 17:14:52 +00:00
void SaveConversationStateLog(ConversationStateLogModel log)
=> throw new NotImplementedException();
2025-03-12 15:13:57 +00:00
DateTimePagination<ConversationStateLogModel> GetConversationStateLogs(string conversationId, ConversationLogFilter filter)
2025-01-30 17:14:52 +00:00
=> throw new NotImplementedException();
2024-02-15 20:43:36 +00:00
#endregion
2025-03-04 23:25:35 +00:00
#region Instruction Log
bool SaveInstructionLogs(IEnumerable<InstructionLogModel> logs)
=> throw new NotImplementedException();
2025-08-11 20:46:35 +00:00
ValueTask<PagedItems<InstructionLogModel>> GetInstructionLogs(InstructLogFilter filter)
2025-03-04 23:25:35 +00:00
=> throw new NotImplementedException();
2025-03-10 17:14:44 +00:00
List<string> GetInstructionLogSearchKeys(InstructLogKeysFilter filter)
=> throw new NotImplementedException();
2025-03-04 23:25:35 +00:00
#endregion
2024-02-04 05:42:13 +00:00
#region Statistics
2025-05-08 05:19:19 +00:00
BotSharpStats? GetGlobalStats(string agentId, DateTime recordTime, StatsInterval interval)
2025-01-28 22:46:59 +00:00
=> throw new NotImplementedException();
2025-05-08 05:19:19 +00:00
bool SaveGlobalStats(BotSharpStatsDelta delta)
2025-01-28 22:46:59 +00:00
=> throw new NotImplementedException();
2025-01-24 05:45:43 +00:00
2024-02-04 05:42:13 +00:00
#endregion
2024-06-14 20:39:56 +00:00
#region Translation
2025-01-30 17:14:52 +00:00
IEnumerable<TranslationMemoryOutput> GetTranslationMemories(IEnumerable<TranslationMemoryQuery> queries)
=> throw new NotImplementedException();
bool SaveTranslationMemories(IEnumerable<TranslationMemoryInput> inputs)
=> throw new NotImplementedException();
2024-06-14 20:39:56 +00:00
#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>
2025-01-30 17:14:52 +00:00
bool AddKnowledgeCollectionConfigs(List<VectorCollectionConfig> configs, bool reset = false)
=> throw new NotImplementedException();
bool DeleteKnowledgeCollectionConfig(string collectionName)
=> throw new NotImplementedException();
IEnumerable<VectorCollectionConfig> GetKnowledgeCollectionConfigs(VectorCollectionConfigFilter filter)
=> throw new NotImplementedException();
bool SaveKnolwedgeBaseFileMeta(KnowledgeDocMetaData metaData)
=> throw new NotImplementedException();
2024-09-17 17:50:39 +00:00
/// <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>
2025-01-30 17:14:52 +00:00
bool DeleteKnolwedgeBaseFileMeta(string collectionName, string vectorStoreProvider, Guid? fileId = null)
=> throw new NotImplementedException();
2025-08-11 20:46:35 +00:00
ValueTask<PagedItems<KnowledgeDocMetaData>> GetKnowledgeBaseFileMeta(string collectionName, string vectorStoreProvider, KnowledgeFileFilter filter)
2025-01-30 17:14:52 +00:00
=> throw new NotImplementedException();
2024-09-09 16:32:31 +00:00
#endregion
2024-12-09 00:29:04 +00:00
#region Crontab
2025-01-30 17:14:52 +00:00
bool UpsertCrontabItem(CrontabItem cron)
=> throw new NotImplementedException();
bool DeleteCrontabItem(string conversationId)
=> throw new NotImplementedException();
2025-08-11 20:46:35 +00:00
ValueTask<PagedItems<CrontabItem>> GetCrontabItems(CrontabItemFilter filter)
2025-01-30 17:14:52 +00:00
=> throw new NotImplementedException();
2024-12-09 00:29:04 +00:00
#endregion
2023-08-10 04:53:22 +00:00
}