-
Notifications
You must be signed in to change notification settings - Fork 35.1k
Add chat enhance action #267113
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?
Add chat enhance action #267113
Conversation
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.
Pull Request Overview
This PR adds a chat enhance action that provides AI-powered prompt enhancement functionality to VS Code's chat interface. The feature allows users to improve their chat prompts with AI suggestions through a sparkle icon button.
Key changes:
- Introduces a new chat enhance action with AI-powered prompt optimization
- Adds context key for tracking enhance operation state
- Implements fallback enhancement logic when AI is unavailable
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
File | Description |
---|---|
src/vs/workbench/contrib/chat/common/chatContextKeys.ts |
Adds context key for tracking enhance operation progress |
src/vs/workbench/contrib/chat/browser/media/chat.css |
Adds styling for the sparkle enhance button with hover effects |
src/vs/workbench/contrib/chat/browser/chat.contribution.ts |
Registers the new chat enhance actions module |
src/vs/workbench/contrib/chat/browser/actions/chatEnhanceActions.ts |
Implements the complete chat enhance functionality with AI integration and fallback logic |
// Add a small delay to see the spinner in action during development/testing | ||
await new Promise(resolve => setTimeout(resolve, 1000)); | ||
|
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.
This hardcoded 1-second delay appears to be for testing purposes and should be removed from production code. Consider removing this line or making it conditional based on a debug flag.
// Add a small delay to see the spinner in action during development/testing | |
await new Promise(resolve => setTimeout(resolve, 1000)); |
Copilot uses AI. Check for mistakes.
}]; | ||
|
||
// Use the proper ExtensionIdentifier constructor for the chat enhance feature | ||
const extensionId = new ExtensionIdentifier('core'); |
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.
Using 'core' as an extension identifier may not be appropriate for the chat enhance feature. Consider using a more specific identifier that represents the chat enhancement functionality, such as 'vscode.chat-enhance' or similar.
const extensionId = new ExtensionIdentifier('core'); | |
const extensionId = new ExtensionIdentifier('vscode.chat-enhance'); |
Copilot uses AI. Check for mistakes.
const enhancementPrompt = `You are an expert prompt engineer specializing in optimizing prompts for AI assistants. Your goal is to transform user prompts into more effective versions that will yield better, more useful responses. | ||
Original prompt: "${input}" | ||
Transform this prompt by applying these enhancement strategies: |
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.
This large prompt template should be extracted to a constant or external resource for better maintainability. Consider moving it to a separate constant at the top of the file or to a dedicated prompt template file.
Copilot uses AI. Check for mistakes.
// Check if the prompt is too vague | ||
if (input.length < 15) { | ||
improvements.push('Please provide more specific details about what you are trying to accomplish.'); | ||
} |
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 magic number 15 for determining if a prompt is too vague should be extracted to a named constant to improve code readability and maintainability.
Copilot uses AI. Check for mistakes.
Adds a sparkle to chat