Added backups of all data, restorable on another computer (#1008)

Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
j-erlerandThorsten Sommer authored and GitHub committed 2026-10-15 16:42:02 +02:00
1 parent ab45580473
commit 936043319c
144 files changed
+10417 -424

No files matched your search

+13 -2
View File
@@ -9,13 +9,13 @@ namespace AIStudio.Chat;
/// </summary>
/// <param name="Type">The type of the file attachment.</param>
/// <param name="FileName">The name of the file, including extension.</param>
/// <param name="FilePath">The full path to the file, including the filename and extension.</param>
/// <param name="FilePath">The full path to the file, including the filename and extension. A file below the data directory, such as a transcript, is stored with a path relative to it.</param>
/// <param name="FileSizeBytes">The size of the file in bytes.</param>
[JsonPolymorphic(TypeDiscriminatorPropertyName = "$type")]
[JsonDerivedType(typeof(FileAttachment), typeDiscriminator: "file")]
[JsonDerivedType(typeof(FileAttachmentImage), typeDiscriminator: "image")]
[JsonDerivedType(typeof(ManagedTranscriptAttachment), typeDiscriminator: "managed_transcript")]
public record FileAttachment(FileAttachmentType Type, string FileName, string FilePath, long FileSizeBytes)
public record FileAttachment(FileAttachmentType Type, string FileName, [property: JsonConverter(typeof(DataDirectoryRelativePathConverter))] string FilePath, long FileSizeBytes)
{
/// <summary>
/// Gets a value indicating whether the file type is forbidden and should not be attached.
@@ -63,6 +63,17 @@ public record FileAttachment(FileAttachmentType Type, string FileName, string Fi
/// </summary>
public virtual FileAttachment Normalize() => FromPath(this.FilePath);
/// <summary>
/// Makes the same attachment for its file at another place, e.g. after the chat holding the file moved.
/// </summary>
/// <remarks>
/// Deliberately no with expression: that one keeps whatever was derived from the old path when
/// the attachment was made, such as FilePathAsUrl, and the source of an image.
/// </remarks>
/// <param name="filePath">The path of the file now.</param>
/// <returns>An attachment of the same kind, with the new path.</returns>
public virtual FileAttachment WithFilePath(string filePath) => new(this.Type, this.FileName, filePath, this.FileSizeBytes);
/// <summary>
/// Creates a FileAttachment from a file path by automatically determining the type,
/// extracting the filename, and reading the file size.