-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: Add message editing functionality to chat interface (#4703) #4727
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
feat: Add message editing functionality to chat interface (#4703) #4727
Conversation
… in Thumbnails component
… data:image/ URIs - Restrict URL validation to only allow data:image/ URIs with proper base64 format - Remove support for HTTP/HTTPS URLs as backend openImage() only supports data URIs - Add regex validation for proper data URI format (data:image/[type];base64,) - Eliminates both XSS and URL redirect vulnerabilities by design - Maintains backward compatibility as codebase only uses data:image/ URIs
|
HECK YES @mrubens WE NEED THIS |
|
This is a MUST HAVE feature. Every LLM chat got an Edit button. Great Job 😎👌 |
|
✅ Security review comments have been addressed in commit 6ebc1fd:
The changes ensure that only safe, properly formatted image data URIs can be rendered, preventing both XSS and redirect attacks flagged by GitHub Advanced Security. |
|
I noticed the edited messages were being duplicated when the task is resumed: I notified @SannidhyaSah, moving to "changes requested" in the meantime. |
|
stale |

Description
Fixes #4703
This PR implements a comprehensive message editing feature that allows users to edit their previous messages in the chat interface, with the conversation automatically resetting to that point. When checkpoints are enabled, it also restores files to the closest checkpoint before the edited message.
Changes Made
Frontend - UI Components
webview-ui/src/components/chat/ChatRow.tsx:Backend - Message Handler
src/core/webview/webviewMessageHandler.ts:editMessagecase handlersrc/shared/WebviewMessage.ts:editMessagemessage type to WebviewMessage interfaceTranslations
webview-ui/src/i18n/locales/*/common.json:Features Implemented
✅ Basic Message Editing
✅ Message History Management
✅ Checkpoint Integration
✅ User Experience
Testing
Verification of Acceptance Criteria
Screenshots/Demo
demo.edit.-.Made.with.Clipchamp.mp4
Checklist
Technical Implementation Details
The implementation leverages existing infrastructure:
Trade-offs and Considerations
This implementation provides a solid foundation for message editing while maintaining consistency with existing codebase patterns and user experience expectations.
Important
Add message editing functionality to chat interface with UI, backend, and translation updates, including tests.
ChatRow.tsx: Added edit button, edit mode with textarea, keyboard shortcuts, and fixed styling issues.webviewMessageHandler.ts: AddededitMessagehandler, checkpoint-aware editing logic, and file restoration.WebviewMessage.ts: AddededitMessagetype.common.jsonin multiple locales to include "edit" and "delete" actions.editMessageinwebviewMessageHandler.test.tsandChatView.test.tsx.This description was created by
for 39e790a. You can customize this summary. It will automatically update as commits are pushed.