Skip to content

fix: Load past conversations using the most recent leaf (#1208)#2041

Open
satyammistari wants to merge 1 commit intohuggingface:mainfrom
satyammistari:fix/chat-ui-bug
Open

fix: Load past conversations using the most recent leaf (#1208)#2041
satyammistari wants to merge 1 commit intohuggingface:mainfrom
satyammistari:fix/chat-ui-bug

Conversation

@satyammistari
Copy link

Description:-
This PR fixes the issue where loading a past conversation with multiple branches would not always land the user on the most recently active branch.

Changes:-

  • Modified createMessagesPath in +page.svelte to identify all leaf nodes (messages without children).
  • Added logic to sort leaf nodes by updatedAt to find the most recent interaction point.
  • Defaults the view to the latest leaf if no leafId is provided in the URL or LocalStorage.

How to Test:-

  • Start a conversation and create a branch by editing an early message.
  • Continue the new branch with 1-2 more messages.
  • Navigate away and back to the conversation.
  • Observe that the UI correctly restores the most recent branch instead of defaulting to the first/last message index.

Fixes #1208

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.

Load past conversations using the most recent leaf to determine the visible conversation tree.

1 participant