-
Notifications
You must be signed in to change notification settings - Fork 16
Prompt Preview Support #433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
corinagum
merged 12 commits into
microsoft:main
from
ShanmathiMayuramKrithivasan:shmayura/prompt-preview
May 11, 2026
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
035496f
Prompt Preview Support
ShanmathiMayuramKrithivasan e62104d
Address comments
ShanmathiMayuramKrithivasan b92891f
Merge branch 'main' into shmayura/prompt-preview
ShanmathiMayuramKrithivasan a64557d
Added helper from Send and address comments
ShanmathiMayuramKrithivasan 2026c90
update sample app
ShanmathiMayuramKrithivasan 4744cde
Address comment
ShanmathiMayuramKrithivasan c8f11ff
Merge branch 'microsoft:main' into shmayura/prompt-preview
ShanmathiMayuramKrithivasan 1903845
Align samples content
ShanmathiMayuramKrithivasan fd3f64a
Merge branch 'main' into shmayura/prompt-preview
ShanmathiMayuramKrithivasan 2684335
fix build errors
ShanmathiMayuramKrithivasan 6a3b406
added 1:1 validation
ShanmathiMayuramKrithivasan 485f965
always strip quotedReply artifacts
ShanmathiMayuramKrithivasan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
Libraries/Microsoft.Teams.Api/Entities/TargetedMessageInfoEntity.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System.Diagnostics.CodeAnalysis; | ||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace Microsoft.Teams.Api.Entities; | ||
|
|
||
|
ShanmathiMayuramKrithivasan marked this conversation as resolved.
|
||
| [Experimental("ExperimentalTeamsTargeted")] | ||
| public class TargetedMessageInfoEntity : Entity | ||
|
ShanmathiMayuramKrithivasan marked this conversation as resolved.
|
||
| { | ||
| [JsonPropertyName("messageId")] | ||
| [JsonPropertyOrder(3)] | ||
| public required string MessageId { get; set; } | ||
|
|
||
| public TargetedMessageInfoEntity() : base("targetedMessageInfo") { } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
134 changes: 134 additions & 0 deletions
134
Tests/Microsoft.Teams.Api.Tests/Entities/TargetedMessageInfoEntityTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,134 @@ | ||
| using System.Text.Json; | ||
|
|
||
| using Microsoft.Teams.Api.Activities; | ||
| using Microsoft.Teams.Api.Entities; | ||
|
|
||
| namespace Microsoft.Teams.Api.Tests.Entities; | ||
|
|
||
| #pragma warning disable ExperimentalTeamsTargeted | ||
| public class TargetedMessageInfoEntityTests | ||
| { | ||
| [Fact] | ||
| public void TargetedMessageInfoEntity_JsonSerialize() | ||
| { | ||
| var entity = new TargetedMessageInfoEntity() | ||
| { | ||
| MessageId = "1772129782775" | ||
| }; | ||
|
|
||
| var json = JsonSerializer.Serialize(entity, new JsonSerializerOptions() | ||
| { | ||
| WriteIndented = true, | ||
| IndentSize = 2, | ||
| DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull | ||
| }); | ||
|
|
||
| Assert.Equal(File.ReadAllText( | ||
| @"../../../Json/Entities/TargetedMessageInfoEntity.json" | ||
| ), json); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void TargetedMessageInfoEntity_JsonSerialize_Derived() | ||
| { | ||
| Entity entity = new TargetedMessageInfoEntity() | ||
| { | ||
| MessageId = "1772129782775" | ||
| }; | ||
|
|
||
| var json = JsonSerializer.Serialize(entity, new JsonSerializerOptions() | ||
| { | ||
| WriteIndented = true, | ||
| IndentSize = 2, | ||
| DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull | ||
| }); | ||
|
|
||
| Assert.Equal(File.ReadAllText( | ||
| @"../../../Json/Entities/TargetedMessageInfoEntity.json" | ||
| ), json); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void TargetedMessageInfoEntity_JsonDeserialize() | ||
| { | ||
| var json = File.ReadAllText(@"../../../Json/Entities/TargetedMessageInfoEntity.json"); | ||
| var entity = JsonSerializer.Deserialize<TargetedMessageInfoEntity>(json); | ||
|
|
||
| Assert.NotNull(entity); | ||
| Assert.Equal("targetedMessageInfo", entity.Type); | ||
| Assert.Equal("1772129782775", entity.MessageId); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void TargetedMessageInfoEntity_JsonDeserialize_Derived() | ||
| { | ||
| var json = File.ReadAllText(@"../../../Json/Entities/TargetedMessageInfoEntity.json"); | ||
| var entity = JsonSerializer.Deserialize<Entity>(json); | ||
|
|
||
| Assert.NotNull(entity); | ||
| Assert.IsType<TargetedMessageInfoEntity>(entity); | ||
|
|
||
| var targeted = (TargetedMessageInfoEntity)entity; | ||
| Assert.Equal("targetedMessageInfo", targeted.Type); | ||
| Assert.Equal("1772129782775", targeted.MessageId); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void AddTargetedMessageInfo_AddsEntity() | ||
| { | ||
| var activity = new MessageActivity("test"); | ||
| activity.AddTargetedMessageInfo("12345"); | ||
|
|
||
| var entity = activity.Entities?.OfType<TargetedMessageInfoEntity>().SingleOrDefault(); | ||
| Assert.NotNull(entity); | ||
| Assert.Equal("12345", entity!.MessageId); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void AddTargetedMessageInfo_DoesNotDuplicate_WhenConcreteEntityExists() | ||
| { | ||
| var activity = new MessageActivity("test") | ||
| .AddEntity(new TargetedMessageInfoEntity { MessageId = "9999" }); | ||
|
|
||
| activity.AddTargetedMessageInfo("12345"); | ||
|
|
||
| var entities = activity.Entities!.OfType<TargetedMessageInfoEntity>().ToList(); | ||
| Assert.Single(entities); | ||
| Assert.Equal("9999", entities[0].MessageId); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void AddTargetedMessageInfo_DoesNotDuplicate_WhenGenericEntityWithMatchingType() | ||
| { | ||
| var activity = new MessageActivity("test") | ||
| .AddEntity(new Entity("targetedMessageInfo")); | ||
|
|
||
| activity.AddTargetedMessageInfo("12345"); | ||
|
|
||
| var entities = activity.Entities!.Where(e => e.Type == "targetedMessageInfo").ToList(); | ||
| Assert.Single(entities); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void AddTargetedMessageInfo_StripsQuotedReplyEntities() | ||
| { | ||
| var activity = new MessageActivity("test") | ||
| .AddEntity(new Entity("quotedReply")); | ||
|
|
||
| activity.AddTargetedMessageInfo("12345"); | ||
|
|
||
| Assert.DoesNotContain(activity.Entities!, e => e.Type == "quotedReply"); | ||
| Assert.Contains(activity.Entities!, e => e.Type == "targetedMessageInfo"); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void AddTargetedMessageInfo_StripsQuotedPlaceholderFromText() | ||
| { | ||
| var activity = new MessageActivity("<quoted messageId=\"12345\"/> Here is my reply"); | ||
|
|
||
| activity.AddTargetedMessageInfo("12345"); | ||
|
|
||
| Assert.Equal("Here is my reply", activity.Text); | ||
| Assert.Contains(activity.Entities!, e => e.Type == "targetedMessageInfo"); | ||
| } | ||
| } |
4 changes: 4 additions & 0 deletions
4
Tests/Microsoft.Teams.Api.Tests/Json/Entities/TargetedMessageInfoEntity.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "type": "targetedMessageInfo", | ||
| "messageId": "1772129782775" | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.