diff --git a/app/MindWork AI Studio/Chat/FileAttachment.cs b/app/MindWork AI Studio/Chat/FileAttachment.cs index a98b3574..4d49b225 100644 --- a/app/MindWork AI Studio/Chat/FileAttachment.cs +++ b/app/MindWork AI Studio/Chat/FileAttachment.cs @@ -9,7 +9,7 @@ namespace AIStudio.Chat; /// The name of the file, including extension. /// The full path to the file, including the filename and extension. /// The size of the file in bytes. -public readonly record struct FileAttachment(FileAttachmentType Type, string FileName, string FilePath, long FileSizeBytes) +public record FileAttachment(FileAttachmentType Type, string FileName, string FilePath, long FileSizeBytes) { /// /// Gets a value indicating whether the file type is forbidden and should not be attached. @@ -55,7 +55,13 @@ public readonly record struct FileAttachment(FileAttachmentType Type, string Fil var fileSize = File.Exists(filePath) ? new FileInfo(filePath).Length : 0; var type = DetermineFileType(filePath); - return new FileAttachment(type, fileName, filePath, fileSize); + return type switch + { + FileAttachmentType.DOCUMENT => new FileAttachment(type, fileName, filePath, fileSize), + FileAttachmentType.IMAGE => new FileAttachmentImage(fileName, filePath, fileSize), + + _ => new FileAttachment(type, fileName, filePath, fileSize), + }; } /// diff --git a/app/MindWork AI Studio/Chat/FileAttachmentImage.cs b/app/MindWork AI Studio/Chat/FileAttachmentImage.cs new file mode 100644 index 00000000..81b46f20 --- /dev/null +++ b/app/MindWork AI Studio/Chat/FileAttachmentImage.cs @@ -0,0 +1,17 @@ +namespace AIStudio.Chat; + +public record FileAttachmentImage(string FileName, string FilePath, long FileSizeBytes) : FileAttachment(FileAttachmentType.IMAGE, FileName, FilePath, FileSizeBytes), IImageSource +{ + /// + /// The type of the image source. + /// + /// + /// Is the image source a URL, a local file path, a base64 string, etc.? + /// + public ContentImageSource SourceType { get; init; } = ContentImageSource.LOCAL_PATH; + + /// + /// The image source. + /// + public string Source { get; set; } = FilePath; +} \ No newline at end of file