mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-04 22:47:21 +00:00
Added tests which guard the prompts and the protected data of visual briefings
This commit is contained in:
12 files changed
+135
-5
No files matched your search
+4
-1
@@ -370,7 +370,10 @@ public sealed partial class VisualBriefingArtifactService
|
||||
/// <summary>
|
||||
/// Defines <c>AddProtectedArtifactData</c> for the visual briefing feature.
|
||||
/// </summary>
|
||||
private static JsonElement AddProtectedArtifactData(VisualBriefingManifest manifest, VisualBriefingRevisionRequest request)
|
||||
/// <remarks>
|
||||
/// Internal, so that a test can check the JSON it writes.
|
||||
/// </remarks>
|
||||
internal static JsonElement AddProtectedArtifactData(VisualBriefingManifest manifest, VisualBriefingRevisionRequest request)
|
||||
{
|
||||
var source = request.Data;
|
||||
var dictionary = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(source.GetRawText(), JSON_OPTIONS) ?? [];
|
||||
|
||||
@@ -107,7 +107,8 @@ internal sealed class VisualBriefingContentStage(StructuredLlmStageRunner stageR
|
||||
Do not return source references, reset controls, filter controls, or entries for ASSET components; AI Studio creates all of them deterministically.
|
||||
""";
|
||||
|
||||
private static string BuildPrompt(VisualBriefingManifest manifest, VisualBriefingEvidenceArtifact evidence, VisualBriefingPlanArtifact plan)
|
||||
// Internal, so that a test can check the JSON this prompt carries:
|
||||
internal static string BuildPrompt(VisualBriefingManifest manifest, VisualBriefingEvidenceArtifact evidence, VisualBriefingPlanArtifact plan)
|
||||
{
|
||||
var components = plan.Sections.SelectMany(section => section.Components).ToArray();
|
||||
var componentIds = components.Select(component => component.ComponentId).ToArray();
|
||||
|
||||
@@ -96,7 +96,8 @@ internal sealed class VisualBriefingEvidenceStage(StructuredLlmStageRunner stage
|
||||
Include only facts supported by the supplied material.
|
||||
""";
|
||||
|
||||
private static string BuildPrompt(VisualBriefingManifest manifest, VisualBriefingPreparedSources preparedSources)
|
||||
// Internal, so that a test can check the JSON this prompt carries:
|
||||
internal static string BuildPrompt(VisualBriefingManifest manifest, VisualBriefingPreparedSources preparedSources)
|
||||
{
|
||||
// The model never sees internal source GUIDs, only short handles. The file name is what lets
|
||||
// it tell the attached documents apart, which are supplied in the same canonical order:
|
||||
|
||||
@@ -107,7 +107,8 @@ internal sealed class VisualBriefingPlanStage(StructuredLlmStageRunner stageRunn
|
||||
Choose HORIZONTAL for a concise overview with few milestones and VERTICAL for longer or explanation-rich chronological narratives.
|
||||
""";
|
||||
|
||||
private static string BuildPrompt(VisualBriefingManifest manifest, VisualBriefingEvidenceArtifact evidence) =>
|
||||
// Internal, so that a test can check the JSON this prompt carries:
|
||||
internal static string BuildPrompt(VisualBriefingManifest manifest, VisualBriefingEvidenceArtifact evidence) =>
|
||||
$"""
|
||||
Audience: {manifest.Settings.AudienceProfile}; {manifest.Settings.AudienceAgeGroup}; {manifest.Settings.AudienceOrganizationalLevel}; {manifest.Settings.AudienceExpertise}
|
||||
Scope instruction: {manifest.Settings.Instruction}
|
||||
|
||||
@@ -181,7 +181,8 @@ internal sealed class VisualBriefingPresentationStage(StructuredLlmStageRunner s
|
||||
MindWork AI Studio owns all colors, typography, surfaces, and chart styling.
|
||||
""";
|
||||
|
||||
private static string BuildPrompt(VisualBriefingManifest manifest, VisualBriefingPlanArtifact plan, VisualBriefingPresentationArtifact? parent)
|
||||
// Internal, so that a test can check the JSON this prompt carries:
|
||||
internal static string BuildPrompt(VisualBriefingManifest manifest, VisualBriefingPlanArtifact plan, VisualBriefingPresentationArtifact? parent)
|
||||
{
|
||||
var parentJson = parent is null ? "none" : JsonSerializer.Serialize(new { parent.Layout, parent.Profile }, VisualBriefingJson.Canonical);
|
||||
return $"""
|
||||
|
||||
Reference in new issue
Block a user