BotSharp/src/Infrastructure/BotSharp.Abstraction/Files/IBotSharpFileService.cs

29 lines
1.4 KiB
C#
Raw Normal View History

2024-05-06 06:51:59 +00:00
namespace BotSharp.Abstraction.Files;
2023-11-09 21:11:36 +00:00
2024-05-06 06:51:59 +00:00
public interface IBotSharpFileService
2023-11-09 21:11:36 +00:00
{
string GetDirectory(string conversationId);
2024-05-13 21:53:41 +00:00
IEnumerable<MessageFileModel> GetChatImages(string conversationId, List<RoleDialogModel> conversations, int offset = 2);
IEnumerable<MessageFileModel> GetMessageFiles(string conversationId, IEnumerable<string> messageIds, bool imageOnly = false);
2024-05-06 22:31:52 +00:00
string? GetMessageFile(string conversationId, string messageId, string fileName);
void SaveMessageFiles(string conversationId, string messageId, List<BotSharpFile> files);
/// <summary>
/// Delete files under messages
/// </summary>
/// <param name="conversationId">Conversation Id</param>
/// <param name="messageIds">Files in these messages will be deleted</param>
/// <param name="targetMessageId">The starting message to delete</param>
/// <param name="newMessageId">If not null, delete messages while input a new message; otherwise, delete messages only</param>
/// <returns></returns>
bool DeleteMessageFiles(string conversationId, IEnumerable<string> messageIds, string targetMessageId, string? newMessageId = null);
bool DeleteConversationFiles(IEnumerable<string> conversationIds);
2024-05-14 16:51:39 +00:00
/// <summary>
/// Get file bytes and content type from data, e.g., "data:image/png;base64,aaaaaaaaa"
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
(string, byte[]) GetFileInfoFromData(string data);
2023-11-09 21:11:36 +00:00
}