LibreChat icon indicating copy to clipboard operation
LibreChat copied to clipboard

🔖 feat: Conversation Bookmarks

Open ohneda opened this issue 7 months ago • 1 comments

Summary

This pull request introduces the following bookmark features:

  • Conversation bookmarks
  • Manage multiple bookmarks
  • Display only specific bookmarked conversations

Change Type

  • [x] New feature (non-breaking change which adds functionality)

UI design is not my strong suit, so it may not be as intuitive as desired. Please feel free to provide feedback or make changes where necessary.

Feature details

Bookmark a conversation

  • Click on the bookmark icon while viewing a conversation to add it to the "Saved" bookmarks.

https://github.com/user-attachments/assets/0c55ddc2-fd90-43c4-a63c-1d554d85f630

Add a new bookmark

  • Open the bookmark table from the header bookmark menu or the side panel.
  • Click the "Add new bookmark" button, fill out the form with the necessary information, and submit.

https://github.com/user-attachments/assets/44108718-e33e-4296-bec8-f05b82667e7d

Add to existing bookmarks

  • If a conversation is already bookmarked, clicking the bookmark menu icon will display a list of your bookmarks. Click on the desired bookmark to add the conversation to it.

https://github.com/user-attachments/assets/82dd7365-cda7-4021-a468-c3c4a9ef9ff0

Reorder bookmarks

  • Open the bookmark table from the side panel and adjust the order as preferred.

https://github.com/user-attachments/assets/879debc5-b509-4a46-8f85-d64c68ec86e2

Edit a bookmark

  • Open the bookmark table from the side panel's bookmark menu, and click the Edit button to modify a bookmark.

https://github.com/user-attachments/assets/90a4f2e4-dc8b-47da-9eb4-cde4da02fd79

Delete a bookmark

  • Open the bookmark table from the side panel, click the Delete button, and delete the bookmark.
  • Deleting a bookmark also removes it from any conversations it's associated with.

https://github.com/user-attachments/assets/1e646641-065c-4926-9837-7635e7fe63c9

Display Specific Bookmarks

  • Select the desired bookmarks from the navigation menu.
  • Multiple bookmarks can be selected to display conversations associated with them.
  • Only conversations tagged with the selected bookmarks will be shown.

https://github.com/user-attachments/assets/15ed3e0d-e1ba-4632-8b35-dca168c63ecc

Rebuild Bookmark Counts

If the count of bookmarked conversations seems incorrect, rebuild the counts. Despite extensive testing, there may still be bugs causing synchronization issues between ConversationTags and conversations. This rebuild button is a precaution and may become obsolete once bookmark bugs are fully resolved.

https://github.com/user-attachments/assets/fa4a533f-4fb8-4e0c-ad5f-9b366d3fbda3

Implementation details

  • Added a tags attribute to Conversations, which is an array of strings.
  • On the client side, these tags are represented as Bookmarks. Terms like Collection, Library, Favorite, or Save might be more appropriate; adjustments can be made as necessary.
  • Although each tag in Conversation is a string, a new model called ConversationTag was added to store metadata.
    • ConversationTag includes attributes such as tag, description, count, and position. Future extensions might involve adding color or icon attributes.
  • The tag attribute in ConversationTag is used as a unique identifier
  • Currently, after creating, updating, or deleting a Bookmark (tag), the client-side query cache is updated to reflect these changes. Since this process complicates the logic, always refetching instead of updating the cache might be a simpler solution.
classDiagram
    class Conversation {
        +String[] tags
    }
    class ConversationTag {
        +String tag
        +String description
        +Number count
        +Number position
    }
    Conversation "1" *-- "0..*" ConversationTag : contains
    Conversation "0..*" --> "0..*" ConversationTag : tags reference
    note for Conversation "tags is a collection of ConversationTag.tag values"
    note for ConversationTag "count represents the number of Conversations\nthat include this tag in their tags array"

Testing

All features have been thoroughly tested to ensure proper functionality. I also verified that existing features have not been degraded as much as possible.

Checklist

  • [x] My code adheres to this project's style guidelines
  • [x] I have performed a self-review of my own code
  • [x] I have commented in any complex areas of my code
  • [x] My changes do not introduce new warnings
  • [x] Local unit tests pass with my changes

ohneda avatar Jul 15 '24 06:07 ohneda