diff --git a/app/MindWork AI Studio/Chat/FileAttachment.cs b/app/MindWork AI Studio/Chat/FileAttachment.cs
index cf4b81fe..9d25526c 100644
--- a/app/MindWork AI Studio/Chat/FileAttachment.cs
+++ b/app/MindWork AI Studio/Chat/FileAttachment.cs
@@ -1,3 +1,5 @@
+using System.Text.Json.Serialization;
+
using AIStudio.Tools.Rust;
namespace AIStudio.Chat;
@@ -9,6 +11,9 @@ 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.
+[JsonPolymorphic(TypeDiscriminatorPropertyName = "$type")]
+[JsonDerivedType(typeof(FileAttachment), typeDiscriminator: "file")]
+[JsonDerivedType(typeof(FileAttachmentImage), typeDiscriminator: "image")]
public record FileAttachment(FileAttachmentType Type, string FileName, string FilePath, long FileSizeBytes)
{
///