GitHub Issue: #479
Implement true in-place editing for both user and AI messages with the following features:
- User messages: Edit inline with resend capability
- AI messages: Edit inline to fix minor errors
- Full button reorganization for user messages: Copy - Edit - Quote - Delete - Fork
- Mark AI messages as edited when modified
- Priority: Both features together
- UI Approach: Inline editing (edit directly in message bubble)
- Button Set: Full reorganization with Quote button added
- AI Edit History: Mark as edited but no history preservation
-
Update Message model (
src/models/message.ts)- Add
edited: booleanproperty to track edited AI messages - Add method
updateContent()to modify message content and set edited flag
- Add
-
Add edited indicator UI (
src/components/MessageItem.vue)- Display "(edited)" text or icon for edited AI messages
- Style the indicator subtly in CSS
-
Add edit mode state (
src/components/MessageItem.vue)- Add reactive
isEditingstate andeditedContentref - Toggle between display mode (current Markdown) and edit mode (textarea)
- Implement inline textarea that matches message styling
- Add reactive
-
Reorganize user message buttons (
src/components/MessageItemActions.vue)- Add new "Quote" button (current Edit behavior: copy to prompt)
- Change "Edit" button to toggle inline editing mode
- Add "Resend" button (visible only in edit mode)
- Add "Cancel" button (visible only in edit mode)
- Reorder buttons: Copy - Edit - Quote - Delete - Fork
-
Implement resend logic (
src/screens/Chat.vue)- Add
onResendAfterEdithandler - Update message content in chat history
- Delete all messages after the edited one
- Re-trigger AI generation with updated message
- Add
-
Add edit mode for AI messages (
src/components/MessageItem.vue)- Same edit state pattern as user messages
- Handle markdown content editing (raw markdown in textarea)
- Preserve artifacts, attachments, tool calls during edit
-
Add AI message edit buttons (
src/components/MessageItemActions.vue)- Add "Edit" button for assistant messages
- Add "Save" and "Cancel" buttons (visible in edit mode)
- Save updates message content and sets
editedflag
-
Add translations (
src/locales/en.json)- "Quote", "Resend", "Cancel", "Save", "(edited)"
-
Write comprehensive tests (
tests/components/message_item.test.ts)- Test edit mode toggle for both message types
- Test resend after user message edit
- Test save after AI message edit
- Test cancel functionality
- Test button visibility states
- Verify edited flag and indicator
-
Run lint and fix any issues
- Ensure all code passes
npm run lint - Fix any type errors or formatting issues
- Ensure all code passes
- Work in small increments: implement, lint, test
- Keep tests passing after each phase
- Confirm completion of each phase before proceeding
- Commit frequently with clear messages
- Wait for final user approval before merging