diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/AdvancedPastePage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/AdvancedPastePage.xaml index bc7f8f82fe..948ae49786 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/AdvancedPastePage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/AdvancedPastePage.xaml @@ -533,7 +533,7 @@ MinHeight="76" HorizontalAlignment="Stretch" AcceptsReturn="True" - 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." + Header="System prompt" 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; }