Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
.Net: Align the behavior of the ChatMessageContent.Content property s…
…etter with streaming counterpart (#6753) ### Motivation and Context This is a follow-up fix for the `ChatMessageContent.Content` property setter, similar to the one that was done to the `StreamingChatMessageContent.Content` property when addressing the PR comment: #6449 (comment). ### Description This change updates the text of the first text item regardless of the value being set. This helps avoid inconsistency that occurs when text content already exists in the items collection, null is set via the Content property, and the setter does nothing, while the getter returns the text message content: ```csharp var items = new ChatMessageContentItemCollection { new TextContent("Hi AI."), }; var chatMessage = new ChatMessageContent(AuthorRole.User, items: items); chatMessage.Content = null; // The property setter does nothing if the value is null. // Fails Assert.Null(chatMessage.Content); // The property getter returns the "Hi AI." text. ```
- Loading branch information