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

Maintain Conversation Tree State on Refresh or Share #1397

Merged
merged 37 commits into from
Aug 25, 2024

Conversation

kramosss
Copy link
Contributor

@kramosss kramosss commented Aug 7, 2024

Added code that maintains the current conversation tree state when refreshing the page or sharing the conversation.

Addresses issue #878

Not sure if this is the most efficient solution but will edit based on feedback.

Co-authored-by: Long Dao [hailongdao1017@gmail.com]
Co-authored-by: Eduardo Rocha [rocha092@csusm.edu]

gloodan17 and others added 28 commits July 22, 2024 14:04
… last branch when editing a user message or retrying an assistant message.
Co-authored-by: Long Dao <hailongdao1017@gmail.com>

Co-authored-by: Eduardo Rocha <rocha092@csusm.edu>
>
>
Co-authored-by: KENNETH <KENNETH.RAMOS95@GMAIL.COM>
Co-authored-by: EDUARDO <EDUARDOROCHAPERSONAL2@GMAIL.COM
Co-authored-by: Kenneth Ramos <kenneth.ramos95@gmail.com>
Co-authored-by: Eduardo Rocha <rocha092@csusm.edu>
Co-authored-by: Long Dao <hailongdao1017@gmail.com>
Co-authored-by: Eduardo Rocha <rocha092@csusm.edu>
Getting the latest changes from the parent repository
Co-authored-by: Long Dao <hailongdao1017@gmail.com>
Co-authored-by: Eduardo Rocha <rocha092@csusm.edu>
Co-authored-by: Long Dao <hailongdao1017@gmail.com>
Co-authored-by: Eduardo Rocha <rocha092@csum.edu>
Co-authored-by: Long Dao <hailongdao1017@gmail.com>
Co-authored-by: Eduardo Rocha <rocha092@csusm.edu>
@nsarrazin
Copy link
Collaborator

Wow really appreciate this! Will take a deep look into this 🔥

@nsarrazin nsarrazin self-requested a review August 7, 2024 18:58
@nsarrazin nsarrazin self-assigned this Aug 7, 2024
kramosss and others added 4 commits August 8, 2024 10:12
Co-authored-by: Long Dao <hailongdao1017@gmail.com>
Co-authored-by: Eduardo Rocha <rocha092@csusm.edu>
Co-authored-by: Long Dao <hailongdao1017@gmail.com>
Co-authored-by: Eduardo Rocha <rocha092@csusm.edu>
Co-authored-by: Long Dao <hailongdao1017@gmail.com>
Co-authored-by: Eduardo Rocha <rocha092@csusm.edu>
@kramosss
Copy link
Contributor Author

kramosss commented Aug 8, 2024

Hi, I believe we fixed the lint issues. Could the tests be ran again to make sure everything is working?

@kramosss
Copy link
Contributor Author

kramosss commented Aug 8, 2024

Hi, I'm a little confused as to why we're getting those errors as we didn't edit those files and when I run npm run lint in my vs code I'm not getting errors. I pretty much just ran npm run format and npm run lint then fixed the few errors that appeared. Should running npx prettier --plugin-search-dir . --write . and npx eslint . --fix be the solution to fixing the warnings?

@nsarrazin
Copy link
Collaborator

Did you merge latest main? We updated quite some deps so it's possible the linting got changed, I can run it for you no worries

@kramosss
Copy link
Contributor Author

kramosss commented Aug 8, 2024

Oh, thank you!

@SvCy
Copy link

SvCy commented Aug 12, 2024

Great work!
This can help retain the tree state in the chat too, I think? working as tree memory? as refresh resets the tree to branch 1/incorrectly.

Copy link
Collaborator

@nsarrazin nsarrazin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! I think in local storage we should keep a record of the shape {[convId]: leafId} so we can keep track of all conversations in memory. can be a second PR though so will merge this one in the meanwhile!

@nsarrazin nsarrazin merged commit 9bfa251 into huggingface:main Aug 25, 2024
3 checks passed
ice91 pushed a commit to ice91/chat-ui that referenced this pull request Oct 30, 2024
* Saving and reloading the current tree on page refresh

* Saving and reloading the current tree on page refresh / Moving to the last branch when editing a user message or retrying an assistant message.

* Update Reload the current tree state on page refresh

* updated updateCurrentIndex function

* Update updateCurrentIndex Function

* Persist current tree in navigation/shared conversations v1

Co-authored-by: Kenneth Ramos <kenneth.ramos95@gmail.com>
Co-authored-by: Eduardo Rocha <rocha092@csusm.edu>

* Removed uncessary comment.

Co-authored-by: Long Dao <hailongdao1017@gmail.com>
Co-authored-by: Eduardo Rocha <rocha092@csusm.edu>

* Added enhance import and document focus fix.

Co-authored-by: Long Dao <hailongdao1017@gmail.com>
Co-authored-by: Eduardo Rocha <rocha092@csum.edu>

* Fixed code to have updated formatting and LoadEvent type in page.ts

Co-authored-by: Long Dao <hailongdao1017@gmail.com>
Co-authored-by: Eduardo Rocha <rocha092@csusm.edu>

* run formatting

* simplify pr

---------

Co-authored-by: Long Dao <hailongdao1017@gmail.com>
Co-authored-by: Eduardo Rocha <rocha092@csusm.edu>
Co-authored-by: Eduardo Rocha <rocha092@csum.edu>
Co-authored-by: Nathan Sarrazin <sarrazin.nathan@gmail.com>
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.

4 participants