From 19403570041e0185f0d58a8ab1100c10622deee8 Mon Sep 17 00:00:00 2001 From: "Shawn Yuan (from Dev Box)" Date: Wed, 12 Nov 2025 17:09:53 +0800 Subject: [PATCH] update Signed-off-by: Shawn Yuan (from Dev Box) --- .../SettingsXAML/Views/AdvancedPastePage.xaml | 1 - .../Views/AdvancedPastePage.xaml.cs | 61 +++++++++++++------ 2 files changed, 41 insertions(+), 21 deletions(-) diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/AdvancedPastePage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/AdvancedPastePage.xaml index 8d6b0afa68..a4991a1345 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/AdvancedPastePage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/AdvancedPastePage.xaml @@ -535,7 +535,6 @@ HorizontalAlignment="Stretch" AcceptsReturn="True" Header="System prompt" - PlaceholderText="You are tasked with reformatting user's clipboard data. Use the user's instructions, and the content of their clipboard below to edit their clipboard content as they have requested it. Do not output anything else besides the reformatted clipboard content." Text="{x:Bind ViewModel.PasteAIProviderDraft.SystemPrompt, Mode=TwoWay}" TextWrapping="Wrap" /> HasServicePrivacyLink(serviceType) ? Visibility.Visible : Visibility.Collapsed; - private void UpdateSystemPromptPlaceholder() + private static bool IsPlaceholderSystemPrompt(string prompt) { - var draft = ViewModel?.PasteAIProviderDraft; - if (draft is null || PasteAISystemPromptTextBox is null) + if (string.IsNullOrWhiteSpace(prompt)) + { + return true; + } + + string trimmedPrompt = prompt.Trim(); + return string.Equals(trimmedPrompt, AdvancedAISystemPromptNormalized, StringComparison.Ordinal) + || string.Equals(trimmedPrompt, SimpleAISystemPromptNormalized, StringComparison.Ordinal); + } + + private static void NormalizeSystemPrompt(PasteAIProviderDefinition draft) + { + if (draft is null) { return; } - PasteAISystemPromptTextBox.PlaceholderText = draft.EnableAdvancedAI + if (IsPlaceholderSystemPrompt(draft.SystemPrompt)) + { + draft.SystemPrompt = string.Empty; + } + } + + private void UpdateSystemPromptPlaceholder() + { + var draft = ViewModel?.PasteAIProviderDraft; + if (draft is null) + { + return; + } + + NormalizeSystemPrompt(draft); + if (PasteAISystemPromptTextBox is null) + { + return; + } + + bool useAdvancedPlaceholder = PasteAIEnableAdvancedAICheckBox?.IsOn ?? draft.EnableAdvancedAI; + PasteAISystemPromptTextBox.PlaceholderText = useAdvancedPlaceholder ? AdvancedAISystemPrompt : SimpleAISystemPrompt; }