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

Edit messages with tree-like chat history #12

Closed
wants to merge 7 commits into from

Conversation

Michael-Tanzer
Copy link
Contributor

@Michael-Tanzer Michael-Tanzer commented Mar 5, 2023

Sorry, I accidentally deleted the old PR (#4)

@Michael-Tanzer
Copy link
Contributor Author

Bug: the current PR prevents the user from changing chat from the sidebar.

# Conflicts:
#	src/lib/Chat.svelte
#	src/lib/Types.svelte
@Niek
Copy link
Owner

Niek commented Mar 8, 2023

Is there any chance that you can simplify the structure to use only a parent key? Then we should be able to merge this.
Thanks!

@Michael-Tanzer
Copy link
Contributor Author

I am working on it, sorry, I have been a bit busy the last couple of days

@Michael-Tanzer
Copy link
Contributor Author

Michael-Tanzer commented Mar 8, 2023

@Niek
I have made a working version of this idea, but with the following caveats:

  • I think having "children" makes it a lot easier to read and write code. The alternative options would be to have a dedicated function to get children at runtime and it would need to be called over and over. The current commit uses children and I think this is the better option in terms of readability.
  • For the new version of the message I am using a prompt, I think this is a terrible idea, but I wasn't sure how to change the rest of the code to fit the possibility of changing the text. I like ChatGPT way of doing it, where the element itself becomes editable, but I am not sure how to do it. A probably easier option for now is to open a modal with a textarea and a submit/cancel buttons.

Example from a previous commit
https://user-images.githubusercontent.com/23483071/223773898-d709494f-a717-4d89-9663-af8959f0b92e.mp4

UI from the (almost) latest commit:
Screenshot_13

@Michael-Tanzer
Copy link
Contributor Author

Michael-Tanzer commented Mar 8, 2023

Of course feel free to change it if you prefer the non-children option. It would be a matter of having a getChildren(id) function that iterates over all messages and returns all the messages that have the same id as id. Then just replace message.children with getChildren(message.id)

@Michael-Tanzer
Copy link
Contributor Author

@Niek any update on this?

@Niek
Copy link
Owner

Niek commented Mar 17, 2023

Sorry @Michael-Tanzer, I got stuck in work tasks. Will try to merge this ASAP.

@Niek
Copy link
Owner

Niek commented Jun 9, 2023

A similar feature has been merged now with #152, thanks again for the contribution @Michael-Tanzer!

@Niek Niek closed this Jun 9, 2023
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.

2 participants