From 1353345311384244adaf1697ed1f580b2b99aadb Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Wed, 25 Feb 2026 21:27:48 +0100 Subject: [PATCH] Switched to SAFE_MARKDOWN_PIPELINE --- app/MindWork AI Studio/Chat/ContentBlockComponent.razor | 6 +++--- app/MindWork AI Studio/Chat/ContentBlockComponent.razor.cs | 7 ++++--- app/MindWork AI Studio/Components/Changelog.razor | 2 +- app/MindWork AI Studio/Components/ChatComponent.razor | 2 +- app/MindWork AI Studio/Components/ConfidenceInfo.razor | 4 ++-- .../Components/Settings/SettingsPanelProviders.razor | 2 +- app/MindWork AI Studio/Dialogs/DocumentCheckDialog.razor | 4 ++-- app/MindWork AI Studio/Dialogs/PandocDialog.razor | 4 ++-- app/MindWork AI Studio/Dialogs/UpdateDialog.razor | 4 ++-- app/MindWork AI Studio/Pages/Home.razor | 6 +++--- app/MindWork AI Studio/Pages/Information.razor | 4 ++-- app/MindWork AI Studio/Tools/Markdown.cs | 6 ++---- 12 files changed, 25 insertions(+), 26 deletions(-) diff --git a/app/MindWork AI Studio/Chat/ContentBlockComponent.razor b/app/MindWork AI Studio/Chat/ContentBlockComponent.razor index f3f2f528..579e8bf2 100644 --- a/app/MindWork AI Studio/Chat/ContentBlockComponent.razor +++ b/app/MindWork AI Studio/Chat/ContentBlockComponent.razor @@ -96,10 +96,10 @@ } else { - + @if (textContent.Sources.Count > 0) { - + } } } @@ -135,4 +135,4 @@ } } - + \ No newline at end of file diff --git a/app/MindWork AI Studio/Chat/ContentBlockComponent.razor.cs b/app/MindWork AI Studio/Chat/ContentBlockComponent.razor.cs index 17894232..29e70487 100644 --- a/app/MindWork AI Studio/Chat/ContentBlockComponent.razor.cs +++ b/app/MindWork AI Studio/Chat/ContentBlockComponent.razor.cs @@ -97,6 +97,7 @@ public partial class ContentBlockComponent : MSGComponentBase return base.OnParametersSetAsync(); } + /// protected override bool ShouldRender() { var currentRenderHash = this.CreateRenderHash(); @@ -167,7 +168,7 @@ public partial class ContentBlockComponent : MSGComponentBase switch (this.Content) { case ContentText text: - var textValue = text.Text ?? string.Empty; + var textValue = text.Text; hash.Add(textValue.Length); hash.Add(textValue.GetHashCode(StringComparison.Ordinal)); hash.Add(text.Sources.Count); @@ -193,7 +194,7 @@ public partial class ContentBlockComponent : MSGComponentBase CodeBlock = { Theme = this.CodeColorPalette }, }; - private string NormalizeMarkdownForRendering(string text) + private static string NormalizeMarkdownForRendering(string text) { var cleaned = text.RemoveThinkTags().Trim(); if (string.IsNullOrWhiteSpace(cleaned)) @@ -293,4 +294,4 @@ public partial class ContentBlockComponent : MSGComponentBase var result = await ReviewAttachmentsDialog.OpenDialogAsync(this.DialogService, this.Content.FileAttachments.ToHashSet()); this.Content.FileAttachments = result.ToList(); } -} +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Components/Changelog.razor b/app/MindWork AI Studio/Components/Changelog.razor index 2d573afb..7ee43021 100644 --- a/app/MindWork AI Studio/Components/Changelog.razor +++ b/app/MindWork AI Studio/Components/Changelog.razor @@ -6,4 +6,4 @@ } - + \ No newline at end of file diff --git a/app/MindWork AI Studio/Components/ChatComponent.razor b/app/MindWork AI Studio/Components/ChatComponent.razor index 1467c01e..3c49a4b5 100644 --- a/app/MindWork AI Studio/Components/ChatComponent.razor +++ b/app/MindWork AI Studio/Components/ChatComponent.razor @@ -127,4 +127,4 @@ - + \ No newline at end of file diff --git a/app/MindWork AI Studio/Components/ConfidenceInfo.razor b/app/MindWork AI Studio/Components/ConfidenceInfo.razor index ed7c45ef..0bf2d044 100644 --- a/app/MindWork AI Studio/Components/ConfidenceInfo.razor +++ b/app/MindWork AI Studio/Components/ConfidenceInfo.razor @@ -28,7 +28,7 @@ @T("Description") - + @if (this.currentConfidence.Sources.Count > 0) { @@ -67,4 +67,4 @@ - + \ No newline at end of file diff --git a/app/MindWork AI Studio/Components/Settings/SettingsPanelProviders.razor b/app/MindWork AI Studio/Components/Settings/SettingsPanelProviders.razor index f89d7b52..8a862702 100644 --- a/app/MindWork AI Studio/Components/Settings/SettingsPanelProviders.razor +++ b/app/MindWork AI Studio/Components/Settings/SettingsPanelProviders.razor @@ -104,7 +104,7 @@ @context.ToName() - + diff --git a/app/MindWork AI Studio/Dialogs/DocumentCheckDialog.razor b/app/MindWork AI Studio/Dialogs/DocumentCheckDialog.razor index dc2ee563..8936e04e 100644 --- a/app/MindWork AI Studio/Dialogs/DocumentCheckDialog.razor +++ b/app/MindWork AI Studio/Dialogs/DocumentCheckDialog.razor @@ -54,7 +54,7 @@ Class="ma-2 pe-4" HelperText="@T("This is the content we loaded from your file — including headings, lists, and formatting. Use this to verify your file loads as expected.")">
- +
@@ -83,4 +83,4 @@ @T("Close") - + \ No newline at end of file diff --git a/app/MindWork AI Studio/Dialogs/PandocDialog.razor b/app/MindWork AI Studio/Dialogs/PandocDialog.razor index f9638ff9..c4f2ac3e 100644 --- a/app/MindWork AI Studio/Dialogs/PandocDialog.razor +++ b/app/MindWork AI Studio/Dialogs/PandocDialog.razor @@ -30,7 +30,7 @@ } else if (!string.IsNullOrWhiteSpace(this.licenseText)) { - + } @@ -226,4 +226,4 @@ } } - + \ No newline at end of file diff --git a/app/MindWork AI Studio/Dialogs/UpdateDialog.razor b/app/MindWork AI Studio/Dialogs/UpdateDialog.razor index 3eaa6db9..f5345523 100644 --- a/app/MindWork AI Studio/Dialogs/UpdateDialog.razor +++ b/app/MindWork AI Studio/Dialogs/UpdateDialog.razor @@ -5,7 +5,7 @@ @this.HeaderText - + @@ -15,4 +15,4 @@ @T("Install now") - + \ No newline at end of file diff --git a/app/MindWork AI Studio/Pages/Home.razor b/app/MindWork AI Studio/Pages/Home.razor index 43118b24..eae947ab 100644 --- a/app/MindWork AI Studio/Pages/Home.razor +++ b/app/MindWork AI Studio/Pages/Home.razor @@ -27,7 +27,7 @@ - + @@ -35,9 +35,9 @@ - + - + \ No newline at end of file diff --git a/app/MindWork AI Studio/Pages/Information.razor b/app/MindWork AI Studio/Pages/Information.razor index e9389237..a859a142 100644 --- a/app/MindWork AI Studio/Pages/Information.razor +++ b/app/MindWork AI Studio/Pages/Information.razor @@ -297,8 +297,8 @@ - + - + \ No newline at end of file diff --git a/app/MindWork AI Studio/Tools/Markdown.cs b/app/MindWork AI Studio/Tools/Markdown.cs index 24946386..49a2309c 100644 --- a/app/MindWork AI Studio/Tools/Markdown.cs +++ b/app/MindWork AI Studio/Tools/Markdown.cs @@ -4,13 +4,11 @@ namespace AIStudio.Tools; public static class Markdown { - private static readonly MarkdownPipeline SAFE_MARKDOWN_PIPELINE = new MarkdownPipelineBuilder() + public static readonly MarkdownPipeline SAFE_MARKDOWN_PIPELINE = new MarkdownPipelineBuilder() .UseAdvancedExtensions() .DisableHtml() .Build(); - public static MarkdownPipeline SecurePipeline => SAFE_MARKDOWN_PIPELINE; - public static MudMarkdownProps DefaultConfig => new() { Heading = @@ -28,4 +26,4 @@ public static class Markdown }, } }; -} +} \ No newline at end of file