From fc103ff3469ab36f79c72cf85b25b10f6b772538 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Sat, 24 May 2025 18:11:07 +0200 Subject: [PATCH] Refactor DeepClone methods to use expression-bodied members. --- app/MindWork AI Studio/Chat/ContentBlock.cs | 17 +++++++---------- app/MindWork AI Studio/Chat/ContentImage.cs | 15 ++++++--------- app/MindWork AI Studio/Chat/ContentText.cs | 13 +++++-------- 3 files changed, 18 insertions(+), 27 deletions(-) diff --git a/app/MindWork AI Studio/Chat/ContentBlock.cs b/app/MindWork AI Studio/Chat/ContentBlock.cs index c418c048..a069c3d8 100644 --- a/app/MindWork AI Studio/Chat/ContentBlock.cs +++ b/app/MindWork AI Studio/Chat/ContentBlock.cs @@ -30,15 +30,12 @@ public class ContentBlock /// public bool HideFromUser { get; init; } - public ContentBlock DeepClone() + public ContentBlock DeepClone() => new() { - return new() - { - Time = this.Time, - ContentType = this.ContentType, - Content = this.Content?.DeepClone(), - Role = this.Role, - HideFromUser = this.HideFromUser, - }; - } + Time = this.Time, + ContentType = this.ContentType, + Content = this.Content?.DeepClone(), + Role = this.Role, + HideFromUser = this.HideFromUser, + }; } \ No newline at end of file diff --git a/app/MindWork AI Studio/Chat/ContentImage.cs b/app/MindWork AI Studio/Chat/ContentImage.cs index 22eff248..6ebe7f49 100644 --- a/app/MindWork AI Studio/Chat/ContentImage.cs +++ b/app/MindWork AI Studio/Chat/ContentImage.cs @@ -34,16 +34,13 @@ public sealed class ContentImage : IContent, IImageSource } /// - public IContent DeepClone() + public IContent DeepClone() => new ContentImage { - return new ContentImage - { - Source = this.Source, - InitialRemoteWait = this.InitialRemoteWait, - IsStreaming = this.IsStreaming, - SourceType = this.SourceType, - }; - } + Source = this.Source, + InitialRemoteWait = this.InitialRemoteWait, + IsStreaming = this.IsStreaming, + SourceType = this.SourceType, + }; #endregion diff --git a/app/MindWork AI Studio/Chat/ContentText.cs b/app/MindWork AI Studio/Chat/ContentText.cs index 66166d7d..13d8f3ce 100644 --- a/app/MindWork AI Studio/Chat/ContentText.cs +++ b/app/MindWork AI Studio/Chat/ContentText.cs @@ -126,15 +126,12 @@ public sealed class ContentText : IContent } /// - public IContent DeepClone() + public IContent DeepClone() => new ContentText { - return new ContentText - { - Text = this.Text, - InitialRemoteWait = this.InitialRemoteWait, - IsStreaming = this.IsStreaming, - }; - } + Text = this.Text, + InitialRemoteWait = this.InitialRemoteWait, + IsStreaming = this.IsStreaming, + }; #endregion