-
Notifications
You must be signed in to change notification settings - Fork 347
WIP: Allow canceling / reverting prompt enhancement #1267
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
|
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 support for canceling and reverting prompt enhancements in the chat UI.
- Introduces
cancelEnhancement
andrevertEnhancement
labels in all locales. - Updates
ChatTextArea
to store original/enhanced prompt state and handle cancel/revert flows. - Adds unit and E2E tests covering enhancement, cancellation, and revert behaviors.
Reviewed Changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
webview-ui/src/i18n/locales/*/kilocode.json | Added enhancePrompt translations for all locales |
webview-ui/src/components/chat/ChatTextArea.tsx | Implemented prompt cancellation and revert logic |
webview-ui/src/components/chat/tests/ChatTextArea.spec.tsx | Added tests for cancel/revert prompt enhancement |
apps/playwright-e2e/tests/enhance-prompt.test.ts | New E2E tests for prompt enhancement flows |
apps/playwright-e2e/tests/chat-with-response-refactored.test.ts | New refactored chat E2E test |
apps/playwright-e2e/playwright.config.ts | Adjusted retry settings |
apps/playwright-e2e/helpers/test-setup-helpers.ts | Extracted shared test setup helper |
apps/playwright-e2e/helpers/enhance-prompt-helpers.ts | Helper functions for E2E prompt enhancement tests |
apps/playwright-e2e/helpers/chat-helpers.ts | Helper functions for E2E chat interactions |
Comments suppressed due to low confidence (1)
webview-ui/src/components/chat/ChatTextArea.tsx:1480
- The translation key namespace appears incorrect; verify whether it should be
t("chat:enhancePrompt.cancelEnhancement")
instead oft("kilocode:chat.enhancePrompt.cancelEnhancement")
.
title={
@@ -46,6 +46,10 @@ | |||
"condense": { | |||
"wantsToCondense": "Kilo Code 想要壓縮你的對話", | |||
"condenseConversation": "壓縮對話" | |||
}, | |||
"enhancePrompt": { | |||
"cancelEnhancement": "取消增强功能", |
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.
Use traditional Chinese characters for zh-TW: change to "取消增強功能".
"cancelEnhancement": "取消增强功能", | |
"cancelEnhancement": "取消增強功能", |
Copilot uses AI. Check for mistakes.
fireEvent.click(enhanceButton) | ||
|
||
// Cancel enhancement | ||
fireEvent.click(enhanceButton) |
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 test helper getEnhancePromptButton
only selects the sparkle icon, so after enhancement or cancellation the icon changes and this selector will fail. Consider selecting by data-testid="enhance-prompt-button"
or updating the helper to cover all states.
Copilot uses AI. Check for mistakes.
console.log("Icon state debug:", { | ||
isEnhancingPrompt, | ||
hasEnhancedText: !!enhancedPromptText, | ||
hasOriginalText: !!originalPromptBeforeEnhancement, | ||
inputLength: inputValue.trim().length, | ||
enhancedLength: enhancedPromptText?.trim().length, | ||
textsMatch: inputValue.trim() === enhancedPromptText?.trim(), | ||
canRevert, | ||
}) |
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.
Remove or guard debug console.log
statements before merging to avoid polluting the production console.
console.log("Icon state debug:", { | |
isEnhancingPrompt, | |
hasEnhancedText: !!enhancedPromptText, | |
hasOriginalText: !!originalPromptBeforeEnhancement, | |
inputLength: inputValue.trim().length, | |
enhancedLength: enhancedPromptText?.trim().length, | |
textsMatch: inputValue.trim() === enhancedPromptText?.trim(), | |
canRevert, | |
}) | |
if (process.env.NODE_ENV === 'development') { | |
console.log("Icon state debug:", { | |
isEnhancingPrompt, | |
hasEnhancedText: !!enhancedPromptText, | |
hasOriginalText: !!originalPromptBeforeEnhancement, | |
inputLength: inputValue.trim().length, | |
enhancedLength: enhancedPromptText?.trim().length, | |
textsMatch: inputValue.trim() === enhancedPromptText?.trim(), | |
canRevert, | |
}) | |
} |
Copilot uses AI. Check for mistakes.
@@ -248,15 +253,43 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>( | |||
return | |||
} | |||
|
|||
// If currently enhancing, cancel the enhancement |
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 multi-line change (handling cancel/revert logic) should be wrapped with // kilocode_change start
and // kilocode_change end
comments per fork guidelines.
Copilot uses AI. Check for mistakes.
@@ -0,0 +1,51 @@ | |||
import { test, type TestFixtures } from "./playwright-base-test" |
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.
New test file should include // kilocode_change - new file
at the top to mark it as a new addition.
Copilot uses AI. Check for mistakes.
Allow canceling / reverting prompt enhancement!
