Kept the unsent message with its chat (#1049)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-10-11 15:52:09 +02:00
1 parent 1c13300988
commit 468d28aa94
18 files changed
+1333 -240

No files matched your search

@@ -56,10 +56,18 @@ public sealed class ChatComposerState
this.HasUserDraft = false;
}
public void RestoreFromTextBlock(ContentText textBlock)
/// <summary>
/// Brings the message the user had not sent yet back into the composer.
/// </summary>
/// <remarks>
/// The draft holds only what the user wrote or attached, so whatever it holds counts as their
/// message. An empty draft leaves the composer free for a chat template.
/// </remarks>
/// <param name="draft">The draft of the chat.</param>
public void RestoreFromDraft(ChatDraft draft)
{
this.UserInput = textBlock.Text;
this.ReplaceFileAttachments(textBlock.FileAttachments);
this.HasUserDraft = true;
this.UserInput = draft.Text;
this.ReplaceFileAttachments(draft.FileAttachments);
this.HasUserDraft = !draft.IsEmpty;
}
}