Skip to content

Conversation

@bzqzheng
Copy link
Contributor

@bzqzheng bzqzheng commented Jun 25, 2025

Add Message Editing Functionality

Overview

This PR introduces message editing, allowing users to revise their prior inputs and view regenerated AI responses. It enables iterative prompt refinement and A/B testing of message variations.

Key Features

  • Edit Button: Hover-to-reveal button on user messages
  • Inline Editing: Seamless textarea interface with smooth transitions
  • Save/Cancel: Save changes or discard edits with intuitive controls
  • Cmd+Enter Shortcut: Instantly saves and re-prompts the AI
  • AI Re-response: Triggers new AI response after edits
  • Message Pruning: Editing any message (e.g. message 2 of 5) prunes all subsequent messages
  • Visual Feedback: Loading indicators, edit mode, and “edited” labels
  • Context Preservation: Maintains coherent conversation flow after edit-triggered regeneration

Technical Details

  • Added edit state to UserMessage component
  • Hooked into useMessageStream for AI regeneration
  • Managed message updates and pruning logic in ChatView
  • Applied consistent UI/UX patterns
  • Included error handling and logging

Files Changed

  • ui/desktop/src/components/UserMessage.tsx: Edit functionality and UI
  • ui/desktop/src/components/ChatView.tsx: Message update and pruning logic
  • ui/desktop/package-lock.json: Dependency updates (if applicable)

This feature enhances the conversation experience by allowing prompt revisions and exploring different AI outputs without breaking the existing flow.

Screenshots

Updated screenshots in the PR thread below.

- Add edit button to user messages with hover states
- Implement inline editing interface with save/cancel actions
- Add state management for edit mode and content tracking
- Integrate with existing AI API to generate new responses
- Add visual indicators for edit mode, loading, and edited status
- Include comprehensive error handling and logging
- Preserve conversation context when regenerating AI responses
@zanesq
Copy link
Collaborator

zanesq commented Jun 25, 2025

@nahiyankhan @spencrmartin for design review

@bzqzheng
Copy link
Contributor Author

bzqzheng commented Jun 25, 2025

@nahiyankhan @spencrmartin for design review

The current textarea/bubble looks tiny in edit mode. I made some UI changes, and here are the screenshots.
It's not pushed to this PR yet. Let me know what you all think, and I can push these changes if they look better.

Screenshot 2025-06-25 at 3 14 09 PM
Screenshot 2025-06-25 at 3 15 00 PM
Screenshot 2025-06-25 at 3 15 07 PM

@spencrmartin
Copy link
Collaborator

spencrmartin commented Jun 25, 2025

Can we cut the emoji use and when edit mode is active rely on the form field to communicate that mode vs showing the status?

@bzqzheng
Copy link
Contributor Author

Can we cut the emoji use and when edit mode is active rely on the form field to communicate that mode vs showing the status?

done.

@michaelneale
Copy link
Collaborator

I like this - would be great if @zanesq gives the blessing as ChatView and UserMessage.tsx as super high trafficked bits of code and very sensitive, but yeah I think this is worthwhile, good idea!

@zanesq
Copy link
Collaborator

zanesq commented Jun 25, 2025

Will take a look and try it out asap!

@bzqzheng
Copy link
Contributor Author

bzqzheng commented Jul 9, 2025

Will take a look and try it out asap!

Hi Zane, following up on this feature PR. Is this still being reviewed? It would be a great UX improvement for goose!

@zanesq
Copy link
Collaborator

zanesq commented Jul 9, 2025

@bzqzheng thanks for the reminder. Agreed, its a nice feature and would definitely want to help get this in. We have a revamped UI coming out shortly so unfortunately you'll need to rebase off that soon. I'll wait to review until we get that out, most likely next week.

@DOsinga
Copy link
Collaborator

DOsinga commented Jul 14, 2025

ok, let's revisit after the big merge (hopefully soon!)

@DOsinga
Copy link
Collaborator

DOsinga commented Jul 16, 2025

ok, merged, so let's continue

@zanesq
Copy link
Collaborator

zanesq commented Jul 24, 2025

@bzqzheng looking forward to this feature, can you pull in main and get this working again?

@bzqzheng
Copy link
Contributor Author

@bzqzheng looking forward to this feature, can you pull in main and get this working again?

Sure, will get to it some time next week.

@bzqzheng
Copy link
Contributor Author

bzqzheng commented Aug 1, 2025

@zanesq the UI major update makes this PR "unmergable" since some files are revamped and deleted.
Created this new PR with the same feature change.

@bzqzheng bzqzheng closed this Aug 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants