From e42b6fa9194fa54840f1d66f19022c75b20ad08b Mon Sep 17 00:00:00 2001 From: Roo Code Date: Fri, 22 Aug 2025 17:40:54 +0000 Subject: [PATCH] fix: restore "Preview System Prompt" button in Prompts settings tab - Added system prompt preview functionality to PromptsSettings component - Added dialog for displaying the system prompt content - Added message handlers for systemPrompt events - Added translation for preview description - Fixes #7328 --- .../components/settings/PromptsSettings.tsx | 75 +++++++++++++++++++ webview-ui/src/i18n/locales/en/prompts.json | 3 +- 2 files changed, 77 insertions(+), 1 deletion(-) diff --git a/webview-ui/src/components/settings/PromptsSettings.tsx b/webview-ui/src/components/settings/PromptsSettings.tsx index d09b53fe47..1712502245 100644 --- a/webview-ui/src/components/settings/PromptsSettings.tsx +++ b/webview-ui/src/components/settings/PromptsSettings.tsx @@ -43,6 +43,7 @@ const PromptsSettings = ({ setCustomCondensingPrompt, includeTaskHistoryInEnhance: contextIncludeTaskHistoryInEnhance, setIncludeTaskHistoryInEnhance: contextSetIncludeTaskHistoryInEnhance, + mode, } = useExtensionState() // Use props if provided, otherwise fall back to context @@ -52,6 +53,9 @@ const PromptsSettings = ({ const [testPrompt, setTestPrompt] = useState("") const [isEnhancing, setIsEnhancing] = useState(false) const [activeSupportOption, setActiveSupportOption] = useState("ENHANCE") + const [isDialogOpen, setIsDialogOpen] = useState(false) + const [selectedPromptContent, setSelectedPromptContent] = useState("") + const [selectedPromptTitle, setSelectedPromptTitle] = useState("") useEffect(() => { const handler = (event: MessageEvent) => { @@ -61,6 +65,12 @@ const PromptsSettings = ({ setTestPrompt(message.text) } setIsEnhancing(false) + } else if (message.type === "systemPrompt") { + if (message.text) { + setSelectedPromptContent(message.text) + setSelectedPromptTitle(`System Prompt (${message.mode} mode)`) + setIsDialogOpen(true) + } } } @@ -122,6 +132,43 @@ const PromptsSettings = ({
+ {/* System Prompt Preview Section */} +
+
+ + + + +
+
+ {t("prompts:systemPrompt.previewDescription")} +
+
+ +
+ + {/* Support Prompts Section */}