-
Notifications
You must be signed in to change notification settings - Fork 476
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
Option to edit messages #3
Comments
Good idea, I started to work on this a bit in commit cd2b9b9. To get it fully working, all messages after the edited one have to be discarded. |
I don't think discarding is a good idea. One way this could be dealt with is by adding a new field to every message (e.g. versions[]). When a message is edited, all the messages before the one that was edited could add to their versions[] the current new version (= old version + 1), while all the ones that came after would have their version unchanged. The user can now choose what "version" of the chat to look at and only the messages with right version would be shown (simple filter) |
But that would be confusing, editing a message other than the last one will affect the context of the messages. That's why ChatGPT removes all later messages if a message is edited.
What do you think? |
Alternatively you could have a tree-like structure in the messages, something like this:
Where
In this case the editing would simply mean adding a new message with a different parent id. Versions could still be used to show the latest version when displaying a chat |
I also wanted to point out that ChatGPT does not discard old messages, you can still see them using the small arrows on the left of the message you edited (see below). This is very similar to my idea. |
Here clicking the arrows will bring back all messages that stemmed from message 2 version 1 |
Ah, I didn't even notice that before, good point. In that case a tree-like structure would indeed be best, although it's not very trivial to iterate through it. |
I made a non-functional proof of concept here: #4, unfortunately I have no idea how Svelte works and the pull request is not currently working. Might be a good starting point though. |
Awesome, I'll check it in the morning and add some comments. |
Fixed the issue in #4 where the new messages were not being shown. The new commit should be backward compatible with the previous implementation, but I haven't tried the message edit functionality |
Good one! I think it can be simplified a bit by having only a |
@all-contributors please add @Michael-Tanzer for ideas and code |
I've put up a pull request to add @Michael-Tanzer! 🎉 |
It's definitely possible, it makes iterating over the chat a bit harder though |
Fixed in #152 |
Hi,
I think the possibility to edit a message like you can do on ChatGPT would be an amazing addition to the project.
To do this it looks like you might need to change the storage of chat from an array to a tree-like structure. And then of course change the API call and chat display parts as well.
I might be able to look into it in a couple of weeks if no one else gets around to doing it first.
Best
The text was updated successfully, but these errors were encountered: