Skip to content
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

Fix issue #78: [Feature] Support editing of messages #89

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

onitbot
Copy link
Collaborator

@onitbot onitbot commented Feb 20, 2025

This pull request fixes #78.

The changes implement message editing functionality by:

  1. Adding an isEditing flag to the Prompt model to track edit state
  2. Modifying the send action logic to handle two scenarios:
    • For editing: Clears the existing responses and prior instructions, updates the instruction with new text, and regenerates
    • For new messages: Creates and generates a new prompt as before

The changes directly address the request to "edit every sent message" by:

  • Providing a mechanism to identify which message is being edited
  • Clearing old responses when a message is edited
  • Regenerating the response with the updated text
  • Preserving the original prompt object while updating its content

This implementation allows users to edit existing messages while maintaining the expected behavior of regenerating responses based on edited content, which matches the requirement that "re-entering a message will remove the older chat history and display a new response."

Automatic fix generated by Onitbot 🤖

@timlenardo
Copy link
Contributor

@onitbot - this implementation is incorrect. Instead of clearing old messages when an instruction is edited, we should treat it the same as pressing the 'regenerate' button: the 'instruction' field of the prompt should be edited, and we should call the generate() method. We'll need to change prompt.instruction to be an array of Strings instead of just a string, and then have it respect the 'generationIndex' field. We'll also need to make sure when the regenerate button is pressed, a new version of the current instruction is appended to the prompt.instruction array. Finally, we need to make sure FinalContextView (and any other view that displays prompt.instruction) shows the correct instruction based on generationIndex.

@onitbot
Copy link
Collaborator Author

onitbot commented Feb 20, 2025

Onitbot started fixing the pr! You can monitor the progress here.

@onitbot
Copy link
Collaborator Author

onitbot commented Feb 20, 2025

Here's a concise overview:

Progress Made:
✓ Converted instruction field to instructions array
✓ Added currentInstruction computed property
✓ Updated views to use new data structure

Remaining Issues:
❌ No implementation of regenerate button functionality to append instructions
❌ Missing logic for instruction editing triggering generate()
❌ Unclear how instruction history is being maintained

Summary: While the foundational data structure changes are in place, critical functional requirements around regeneration and editing behaviors are still missing. The solution is incomplete and needs additional implementation work to fully meet the requirements.

Recommendation: Focus next steps on implementing the missing regeneration and editing functionality while ensuring proper history maintenance.

@timlenardo
Copy link
Contributor

@onitbot - can you proceed and fix the remaining issues you listed above?
❌ No implementation of regenerate button functionality to append instructions
❌ Missing logic for instruction editing triggering generate()
❌ Unclear how instruction history is being maintained

Regarding the 2nd point, there should be an edit button on the view that displays the instruction. When clicked, this should make the instruction editable. In the place of the edit button, there should be a "send" button and a "cancel" button. If they edit and click send, then we should trigger generate() again. This should append the new instruction the instruction array and increment the generationIndex.

@onitbot
Copy link
Collaborator Author

onitbot commented Feb 20, 2025

Onitbot started fixing the pr! You can monitor the progress here.

1 similar comment
@onitbot
Copy link
Collaborator Author

onitbot commented Feb 20, 2025

Onitbot started fixing the pr! You can monitor the progress here.

@onitbot
Copy link
Collaborator Author

onitbot commented Feb 20, 2025

Based on the provided changes, here's a concise overview:

✅ Successfully Implemented:

  • Complete message editing system with proper UI controls
  • Proper generation flow handling with state management
  • History preservation maintaining all previous interactions
  • Clear UI feedback and state transitions

The changes appear to fully address the core requirements by implementing a comprehensive editing system that maintains history while allowing new generations. The implementation follows existing patterns and provides appropriate user feedback.

🔍 No explicit issues are mentioned as remaining unresolved. The changes seem to form a complete solution that meets all specified requirements.

Unless there are specific performance concerns or edge cases not mentioned in the overview, this appears to be a successful resolution of the original issues.

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.

[Feature] Support editing of messages
2 participants