2025-05-28 00:56:14 +00:00
|
|
|
using BotSharp.Abstraction.Files;
|
2025-04-03 23:02:34 +00:00
|
|
|
using BotSharp.Abstraction.Files.Models;
|
2025-10-15 18:24:27 +00:00
|
|
|
using BotSharp.Abstraction.Files.Options;
|
2025-04-03 23:02:34 +00:00
|
|
|
|
|
|
|
|
namespace BotSharp.Plugin.Google.Core
|
|
|
|
|
{
|
2025-05-28 00:56:14 +00:00
|
|
|
public class NullFileStorageService : IFileStorageService
|
2025-04-03 23:02:34 +00:00
|
|
|
{
|
|
|
|
|
public string GetDirectory(string conversationId)
|
|
|
|
|
{
|
|
|
|
|
return $"FakeDirectory/{conversationId}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IEnumerable<string> GetFiles(string relativePath, string? searchQuery = null)
|
|
|
|
|
{
|
|
|
|
|
return new List<string> { "FakeFile1.txt", "FakeFile2.txt" };
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-28 00:56:14 +00:00
|
|
|
public BinaryData GetFileBytes(string fileStorageUrl)
|
2025-04-03 23:02:34 +00:00
|
|
|
{
|
2025-05-28 00:56:14 +00:00
|
|
|
var bytes = new byte[] { 0x00, 0x01, 0x02 };
|
|
|
|
|
return BinaryData.FromBytes(bytes);
|
2025-04-03 23:02:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool SaveFileStreamToPath(string filePath, Stream stream)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-28 00:56:14 +00:00
|
|
|
public bool SaveFileBytesToPath(string filePath, BinaryData binary)
|
2025-04-03 23:02:34 +00:00
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string GetParentDir(string dir, int level = 1)
|
|
|
|
|
{
|
|
|
|
|
return "FakeParentDirectory";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool ExistDirectory(string? dir)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void CreateDirectory(string dir)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void DeleteDirectory(string dir)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string BuildDirectory(params string[] segments)
|
|
|
|
|
{
|
|
|
|
|
return string.Join("/", segments);
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-17 00:20:53 +00:00
|
|
|
public Task<IEnumerable<MessageFileModel>> GetMessageFileScreenshotsAsync(string conversationId, IEnumerable<string> messageIds, MessageFileScreenshotOptions options)
|
2025-04-03 23:02:34 +00:00
|
|
|
{
|
|
|
|
|
return Task.FromResult<IEnumerable<MessageFileModel>>(new List<MessageFileModel>
|
|
|
|
|
{
|
|
|
|
|
new MessageFileModel { FileName = "Screenshot1.png" },
|
|
|
|
|
new MessageFileModel { FileName = "Screenshot2.png" }
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-16 20:48:54 +00:00
|
|
|
public IEnumerable<MessageFileModel> GetMessageFiles(string conversationId, IEnumerable<string> messageIds, MessageFileOptions? options = null)
|
2025-04-03 23:02:34 +00:00
|
|
|
{
|
|
|
|
|
return new List<MessageFileModel>
|
|
|
|
|
{
|
|
|
|
|
new MessageFileModel { FileName = "File1.docx" },
|
|
|
|
|
new MessageFileModel { FileName = "File2.pdf" }
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string GetMessageFile(string conversationId, string messageId, string source, string index, string fileName)
|
|
|
|
|
{
|
|
|
|
|
return $"FakePath/{fileName}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool SaveMessageFiles(string conversationId, string messageId, string source, List<FileDataModel> files)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool DeleteMessageFiles(string conversationId, IEnumerable<string> messageIds, string targetMessageId,
|
|
|
|
|
string? newMessageId = null)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool DeleteConversationFiles(IEnumerable<string> conversationIds)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string GetUserAvatar()
|
|
|
|
|
{
|
|
|
|
|
return "FakeUserAvatar.png";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool SaveUserAvatar(FileDataModel file)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool SaveSpeechFile(string conversationId, string fileName, BinaryData data)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BinaryData GetSpeechFile(string conversationId, string fileName)
|
|
|
|
|
{
|
|
|
|
|
return BinaryData.FromBytes(new byte[] { 0x03, 0x04, 0x05 });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool SaveKnowledgeBaseFile(string collectionName, string vectorStoreProvider, Guid fileId, string fileName,
|
|
|
|
|
BinaryData fileData)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool DeleteKnowledgeFile(string collectionName, string vectorStoreProvider, Guid? fileId = null)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string GetKnowledgeBaseFileUrl(string collectionName, string vectorStoreProvider, Guid fileId, string fileName)
|
|
|
|
|
{
|
|
|
|
|
return $"https://fakeurl.com/{fileName}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BinaryData GetKnowledgeBaseFileBinaryData(string collectionName, string vectorStoreProvider, Guid fileId,
|
|
|
|
|
string fileName)
|
|
|
|
|
{
|
|
|
|
|
return BinaryData.FromBytes(new byte[] { 0x06, 0x07, 0x08 });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|