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

Add "Scroll Up to Load More" and Fix Old Replies Issue in Chat Component. #12348

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

Conversation

Woo0ood
Copy link
Contributor

@Woo0ood Woo0ood commented Jan 3, 2025

Summary

Resolves #11848

This PR introduces a new feature to load more messages by scrolling up, along with a bug fix that depends on this modification.

This PR is a resubmission as requested, as part of the now-closed #11850 .

New Feature

  • Add upward scrolling to load more messages in the Chat component
    • Previously, the Chat component could only display the most recent 40 messages, making it impossible to view earlier messages. This update introduces an upward scrolling feature that allows users to load more historical messages when they scroll to the top of the chat window.

Fixed

  • Fix the issue where old replies were displayed after regenerating a reply and switching conversations
    • Fixed the issue where old replies were displayed when switching conversations after regenerating a reply and then switching back. Now, the new reply will be displayed immediately without needing to refresh the page.

Modification Details

This section was automatically generated by GitHub Copilot actions.

This pull request introduces several changes to the chat history feature, focusing on improving the scrolling experience and handling the loading of older messages. The most important changes include adding new properties and methods to handle infinite scrolling, updating context and hooks to support these changes, and ensuring proper integration across components.

Enhancements to Chat History Scrolling:

Context and Hook Updates:

Component Integration:

Localization:

  • web/i18n/en-US/share-app.ts and web/i18n/zh-Hans/share-app.ts: Added translations for the "Loaded all messages" message. [1] [2]

API Adjustments:

  • web/service/share.ts: Updated the fetchChatList function to support pagination by accepting an optional firstId parameter.

Checklist

Important

Please review the checklist below before submitting your pull request.

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

…ponent.

Previously, the Chat component was limited to displaying the most recent 40 messages, with no option to load older messages. This commit addresses this limitation by adding a scroll-up feature that allows users to load more messages as they scroll to the top of the chat window.
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. ☕️ typescript Pull request that update TypeScript code. 💪 enhancement New feature or request labels Jan 3, 2025
@crazywoola crazywoola requested review from iamjoel and zxhlyh January 3, 2025 13:55
…tching conversations.

Fixed an issue where, after regenerating a reply, switching to another conversation and then switching back would display the old reply. The correct new reply would only show after refreshing the page.
@Woo0ood Woo0ood changed the title feat: add scroll up to load more messages functionality to Chat component. Add "Scroll Up to Load More" and Fix Old Replies Issue in Chat Component. Jan 3, 2025
@Woo0ood
Copy link
Contributor Author

Woo0ood commented Jan 24, 2025

@iamjoel @zxhlyh Dear reviewers, sorry to bother you! My PR has been quietly sitting there for over 20 days now and is starting to grow mushrooms 🍄.
If you have some spare time, could you kindly take a look and give it some of your precious attention, so I can move forward to the next step.
Thank you both for your hard work! Of course, if you’re super busy, I can let it sit for a bit longer and even provide some fertilizer to help those mushrooms grow.

@iamjoel
Copy link
Collaborator

iamjoel commented Jan 26, 2025

@iamjoel @zxhlyh Dear reviewers, sorry to bother you! My PR has been quietly sitting there for over 20 days now and is starting to grow mushrooms 🍄. If you have some spare time, could you kindly take a look and give it some of your precious attention, so I can move forward to the next step. Thank you both for your hard work! Of course, if you’re super busy, I can let it sit for a bit longer and even provide some fertilizer to help those mushrooms grow.

Thanks for your great job! I will review it as soon as possible after the Chinese New Year holiday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💪 enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files. ☕️ typescript Pull request that update TypeScript code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Upward Scrolling to Load More Messages in Chat Component
2 participants