diff --git a/samples/DragonCopilot/Workflow/SampleExtension.Web/Services/ProcessingService.cs b/samples/DragonCopilot/Workflow/SampleExtension.Web/Services/ProcessingService.cs index b06c483a..884b420c 100644 --- a/samples/DragonCopilot/Workflow/SampleExtension.Web/Services/ProcessingService.cs +++ b/samples/DragonCopilot/Workflow/SampleExtension.Web/Services/ProcessingService.cs @@ -200,17 +200,14 @@ private static VisualizationResource CreateAdaptiveCardResource(List { type = "TextBlock", text = "🔍 Clinical Entities Extracted", - weight = "Bolder", - size = "Large", - color = "Accent" + weight = "bolder", }, new { type = "TextBlock", text = $"Found {entities.Count} clinical {(entities.Count == 1 ? "entity" : "entities")} in the note", wrap = true, - size = "Medium", - spacing = "Small" + spacing = "small" } }; @@ -227,7 +224,7 @@ private static VisualizationResource CreateAdaptiveCardResource(List { type = "Container", style = "emphasis", - spacing = "Medium", + spacing = "medium", items = new object[] { new @@ -245,8 +242,7 @@ private static VisualizationResource CreateAdaptiveCardResource(List { type = "TextBlock", text = GetEntityIcon(entityType), - size = "Large", - spacing = "None" + spacing = "none" } } }, @@ -260,25 +256,21 @@ private static VisualizationResource CreateAdaptiveCardResource(List { type = "TextBlock", text = $"**{GetEntityTypeDisplayName(entityType)}**", - weight = "Bolder", - size = "Medium", - spacing = "None" + weight = "bolder", + spacing = "none" }, new { type = "TextBlock", text = entityName, - color = "Accent", - spacing = "None" + spacing = "none" }, new { type = "TextBlock", text = entityValue, wrap = true, - size = "Small", - color = "Default", - spacing = "Small" + spacing = "small" } } } @@ -314,22 +306,22 @@ private static VisualizationResource CreateAdaptiveCardResource(List { type = "TextBlock", text = $"Processed at {DateTime.UtcNow:yyyy-MM-dd HH:mm:ss} UTC", - size = "Small", horizontalAlignment = "Right", - spacing = "Medium" + spacing = "medium" }); return new VisualizationResource { Id = Guid.NewGuid().ToString(), Type = "AdaptiveCard", - Subtype = VisualizationSubtype.Note, + Subtype = VisualizationSubtype.Timeline, CardTitle = "Clinical Entities Extracted", - AdaptiveCardPayload = new + PartnerLogo = "https://example.com/assets/sample-extension-logo.png", + AdaptiveCardPayload = new AdaptiveCardPayload { - type = "AdaptiveCard", - version = "1.3", - body = bodyElements.ToArray() + Type = "AdaptiveCard", + Version = "1.3", + Body = bodyElements.ToArray(), }, Actions = new List { @@ -337,13 +329,14 @@ private static VisualizationResource CreateAdaptiveCardResource(List { Title = "Accept Analysis", Action = VisualizationActionType.Accept, - ActionType = ActionButtonType.Primary + ActionType = ActionButtonType.Accept, + Code = "Accept", }, new() { Title = "Copy to Note", Action = VisualizationActionType.Copy, - ActionType = ActionButtonType.Secondary, + ActionType = ActionButtonType.Copy, Code = "CLINICAL ENTITY ANALYSIS\n\nEntities detected:\n" + string.Join("\n", entities.Select(e => $"- {GetEntityNameFromResource(e)} ({GetEntityTypeFromResource(e)})")) }, @@ -351,9 +344,11 @@ private static VisualizationResource CreateAdaptiveCardResource(List { Title = "Reject Analysis", Action = VisualizationActionType.Reject, - ActionType = ActionButtonType.Tertiary + ActionType = ActionButtonType.Reject, + Code = "Reject" } }, + References = new List(), PayloadSources = new List { new() diff --git a/src/Dragon.Copilot.Models/ActionButtonType.cs b/src/Dragon.Copilot.Models/ActionButtonType.cs index d4f85219..af0ec9ef 100644 --- a/src/Dragon.Copilot.Models/ActionButtonType.cs +++ b/src/Dragon.Copilot.Models/ActionButtonType.cs @@ -12,17 +12,22 @@ namespace Dragon.Copilot.Models; public enum ActionButtonType { /// - /// Primary action button style + /// Accept action button /// - Primary, + Accept, /// - /// Secondary action button style + /// Copy action button /// - Secondary, + Copy, /// - /// Tertiary action button style + /// Reject action button /// - Tertiary + Reject, + + /// + /// Update note action button + /// + UpdateNote } diff --git a/src/Dragon.Copilot.Models/AdaptiveCardPayload.cs b/src/Dragon.Copilot.Models/AdaptiveCardPayload.cs new file mode 100644 index 00000000..2e4cd705 --- /dev/null +++ b/src/Dragon.Copilot.Models/AdaptiveCardPayload.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Dragon.Copilot.Models; + +/// +/// Adaptive card payload structure +/// +public class AdaptiveCardPayload +{ + /// + /// Adaptive card schema URL + /// + [JsonPropertyName("$schema")] + public string Schema {get; } = "http://adaptivecards.io/schemas/adaptive-card.json"; + + /// + /// Type of the card (always "AdaptiveCard") + /// + [JsonPropertyName("type")] + public string Type { get; set; } = "AdaptiveCard"; + + /// + /// Adaptive card version + /// + [JsonPropertyName("version")] + public string Version { get; init; } = "1.3"; + + /// + /// Body elements of the adaptive card + /// + [JsonPropertyName("body")] + public IList Body { get; init; } = new List(); +} \ No newline at end of file diff --git a/src/Dragon.Copilot.Models/VisualizationResource.cs b/src/Dragon.Copilot.Models/VisualizationResource.cs index f81a41fb..a81cf7d0 100644 --- a/src/Dragon.Copilot.Models/VisualizationResource.cs +++ b/src/Dragon.Copilot.Models/VisualizationResource.cs @@ -45,7 +45,7 @@ public class VisualizationResource : IResource /// Adaptive card payload (required) /// [JsonPropertyName("adaptive_card_payload")] - public required object AdaptiveCardPayload { get; set; } + public required AdaptiveCardPayload AdaptiveCardPayload { get; set; } /// /// Available actions for the card