Skip to content

Commit 39026a9

Browse files
authored
Merge branch 'microsoft:main' into gauravkeshre/doc/adding_howto_link_model_embedding_deployment
2 parents d812226 + c95ddad commit 39026a9

File tree

2 files changed

+39
-4
lines changed

2 files changed

+39
-4
lines changed

dotnet/packages/Microsoft.TeamsAI/Microsoft.TeamsAI/Application/Application.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ public Application<TState> OnMessageFetchTask(MessageFetchTaskHandler<TState> ha
684684
}
685685

686686

687-
Activity activity = ActivityUtilities.CreateInvokeResponseActivity(response);
687+
Activity activity = ActivityUtilities.CreateInvokeResponseActivity(result);
688688
await turnContext.SendActivityAsync(activity, cancellationToken);
689689
};
690690
AddRoute(routeSelector, routeHandler, isInvokeRoute: true);

dotnet/packages/Microsoft.TeamsAI/Microsoft.TeamsAI/Application/StreamingChannelData.cs

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Newtonsoft.Json;
22
using Newtonsoft.Json.Converters;
3+
using Newtonsoft.Json.Linq;
34
using Newtonsoft.Json.Serialization;
45

56
namespace Microsoft.Teams.AI.Application
@@ -37,15 +38,49 @@ public class StreamingChannelData
3738

3839
/// <summary>
3940
/// Sets the Feedback Loop in Teams that allows a user to
40-
/// give thumbs up or down to a response.
41+
/// give thumbs up or down to a response. Should not be set if setting feedbackLoopType.
4142
/// </summary>
4243
[JsonProperty(PropertyName = "feedbackLoopEnabled")]
4344
public bool? feedbackLoopEnabled { get; set; }
4445

4546
/// <summary>
46-
/// Represents the type of feedback loop. Set to "default" by default. It can be set to one of "default" or "custom".
47+
/// Represents the type of feedback loop. It can be set to one of "default" or "custom".
4748
/// </summary>
48-
[JsonProperty(PropertyName = "feedbackLoopType")]
49+
[JsonConverter(typeof(FeedbackLoopTypeConverter))]
50+
[JsonProperty(PropertyName = "feedbackLoop")]
4951
public string? feedbackLoopType { get; set; }
52+
53+
/// <summary>
54+
/// Converts feedbackLoopType string to/from the type property of a feedbackLoop object expected within a channelData JSON object.
55+
/// </summary>
56+
private class FeedbackLoopTypeConverter : JsonConverter<string?>
57+
{
58+
public override void WriteJson(JsonWriter writer, string? value, JsonSerializer serializer)
59+
{
60+
if (value is not null)
61+
{
62+
JObject obj = new JObject { { "type", value } };
63+
obj.WriteTo(writer);
64+
}
65+
else
66+
{
67+
writer.WriteNull(); // Ensure null values are handled properly
68+
}
69+
}
70+
71+
public override string? ReadJson(JsonReader reader, Type objectType, string? existingValue, bool hasExistingValue, JsonSerializer serializer)
72+
{
73+
if (reader.TokenType == JsonToken.Null)
74+
return null;
75+
76+
JObject obj = JObject.Load(reader);
77+
JToken? token = obj?["type"];
78+
return token?.ToString();
79+
}
80+
}
5081
}
5182
}
83+
84+
85+
86+

0 commit comments

Comments
 (0)