-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat: add saved prompts feature #11152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Implements the Saved Prompts feature as requested in issue #11151. Features: - Create, edit, and delete saved prompts - Associate prompts with specific API configurations - Auto-switch API config when using a prompt - Import/export saved prompts as JSON - Bookmark icon dropdown near chat input for quick access - Full CRUD management in Settings Files added/modified: - packages/types/src/saved-prompt.ts: Zod schema and types - packages/types/src/global-settings.ts: Add savedPrompts to schema - packages/types/src/vscode-extension-host.ts: Message types - src/core/webview/webviewMessageHandler.ts: CRUD handlers - webview-ui/src/components/settings/SavedPromptsSettings.tsx: Settings UI - webview-ui/src/components/chat/SavedPromptsDropdown.tsx: Chat dropdown - webview-ui/src/context/ExtensionStateContext.tsx: State management - webview-ui/src/i18n/locales/en/settings.json: Translations - webview-ui/src/i18n/locales/en/chat.json: Translations Closes #11151
Review complete. Found 3 issues that should be addressed before merging.
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
| title: t("common:savedPrompts.exportTitle"), | ||
| }) | ||
|
|
||
| if (saveUri) { | ||
| await fs.writeFile(saveUri.fsPath, JSON.stringify(exportData, null, 2), "utf8") | ||
| vscode.window.showInformationMessage(t("common:savedPrompts.exportSuccess")) | ||
| await saveLastExportPath(provider, "lastSavedPromptsExportPath", saveUri.fsPath) | ||
| } | ||
| } catch (error) { | ||
| provider.log(`Error exporting saved prompts: ${JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`) | ||
| vscode.window.showErrorMessage(t("common:savedPrompts.exportError")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The translation keys used here (common:savedPrompts.exportTitle, common:savedPrompts.exportSuccess, common:savedPrompts.exportError, etc.) are not defined in src/i18n/locales/en/common.json. This will cause the i18n system to display raw keys like "common:savedPrompts.exportTitle" instead of user-friendly text in VS Code dialogs. The savedPrompts object needs to be added to the backend's common.json locale file with keys for exportTitle, exportSuccess, exportError, importTitle, invalidFormat, importSuccess, and importError.
Fix it with Roo Code or mention @roomote and request a fix.
| import React, { useEffect, useRef, useState } from "react" | ||
| import { Bookmark, ChevronDown, Settings } from "lucide-react" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useRef and ChevronDown are imported but never used in this file. These should be removed to keep the code clean.
| import React, { useEffect, useRef, useState } from "react" | |
| import { Bookmark, ChevronDown, Settings } from "lucide-react" | |
| import React, { useEffect, useState } from "react" | |
| import { Bookmark, Settings } from "lucide-react" |
Fix it with Roo Code or mention @roomote and request a fix.
| @@ -0,0 +1,353 @@ | |||
| import React, { useState, useEffect } from "react" | |||
| import { Plus, Trash2, Edit2, Download, Upload, Bookmark } from "lucide-react" | |||
| import { Trans } from "react-i18next" | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trans is imported but never used in this file. Consider removing this unused import.
| import { Trans } from "react-i18next" | |
| import React, { useState, useEffect } from "react" |
Fix it with Roo Code or mention @roomote and request a fix.
Related GitHub Issue
Closes: #11151
Description
This PR implements the Saved Prompts feature as requested in issue #11151. Users can now create, manage, and quickly access saved prompts during chat.
Key implementation details:
packages/types/src/saved-prompt.ts): Zod schema for SavedPrompt with id, name, content, description, apiConfigId, and timestampssrc/core/webview/webviewMessageHandler.ts): Full CRUD operations for saved prompts with import/export functionalitywebview-ui/src/components/settings/SavedPromptsSettings.tsx): Complete settings panel for managing saved promptswebview-ui/src/components/chat/SavedPromptsDropdown.tsx): Bookmark icon dropdown near chat input for quick prompt accessFeatures implemented per user confirmation:
Test Procedure
Pre-Submission Checklist
Documentation Updates
Additional Notes
This implementation follows existing patterns used in SlashCommandsSettings and SkillsSettings for consistency. The feature uses the existing global state persistence mechanism for storing saved prompts.
Important
Adds a saved prompts feature with CRUD operations, UI components, state management, and translations.
webviewMessageHandler.ts.SavedPromptsDropdown.tsx: Dropdown for quick access to saved prompts in chat.SavedPromptsSettings.tsx: Settings panel for managing saved prompts.ExtensionStateContextfor reactive updates.savedPrompt.tsfor prompt schema and types.chat.jsonandsettings.json.This description was created by
for 0be1980. You can customize this summary. It will automatically update as commits are pushed.