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

toolkit: add pinned chats #774

Merged
merged 14 commits into from
Sep 24, 2024
Merged

Conversation

danylo-boiko
Copy link
Contributor

@danylo-boiko danylo-boiko commented Sep 17, 2024

Description

  • Added options to pin/unpin chats in the left menu
  • Fixed the top margin for the left menu (in collapsed mode)

AI Description

This PR introduces a new feature for pinning conversations, allowing users to mark important conversations for quick access. It adds a new column, is_pinned, to the conversations table in the database, with a default value of false. The PR also includes the following changes:

  • A new function, toggle_conversation_pin, is added to the conversation.py file. This function updates the is_pinned field of a conversation by its ID.
  • The Conversation class in conversation.pyis modified to include a new property,is_pinned, which is a mapped column of type Booleanwith a default value ofFalse`.
  • The get_conversations function in conversation.py is updated to include a new optional parameter, order_by, which allows for ordering conversations by a specified field.
  • The list_conversations function in conversation.py is modified to include a new optional parameter, order_by, for ordering conversations.
  • The update_conversation function in conversation.py is updated to include the is_pinned field in the returned conversation data.
  • A new function, toggle_conversation_pin, is added to the conversation.py file. This function updates the is_pinned field of a conversation by its ID.
  • The ConversationFileAssociationFactory class in conversation.py is modified to include a new property, is_pinned, with a default value of False.
  • A new test function, test_toggle_conversation_pin, is added to the test_conversation.py file. This function tests the toggle_conversation_pin function by creating a conversation with is_pinned set to False, updating it to True, and asserting that the conversation was updated correctly.
  • A new icon, Pin, is added to the icons folder in the assets directory. This icon is used to represent the pinning feature in the user interface.
  • The index.ts file in the icons folder is updated to export the Pin icon.
  • The client.ts file in the cohere-client folder is modified to include a new function, toggleConversationPin, which toggles the pin status of a conversation.
  • The schemas.gen.ts file in the cohere-client folder is updated to include a new type, ToggleConversationPinRequest, which represents a request to toggle the pin status of a conversation.
  • The services.gen.ts file in the cohere-client folder is modified to include a new function, toggleConversationPinV1ConversationsConversationIdTogglePinPut, which toggles the pin status of a conversation.
  • The types.gen.ts file in the cohere-client folder is updated to include a new type, ToggleConversationPinRequest, which represents a request to toggle the pin status of a conversation.
  • The ConversationCard component in the ConversationListPanelGroup.tsx file is modified to include a new property, isPinned, which indicates whether the conversation is pinned.
  • The ConversationList component in the ConversationListPanelGroup.tsx file is updated to use the orderBy parameter when fetching conversations, ensuring that pinned conversations are displayed first.
  • The ConversationListPanelGroup component in the ConversationListPanelGroup.tsx file is modified to include a new property, isPinned, which indicates whether the conversation is pinned.
  • The Icon component in the Icon.tsx file is updated to include a new icon, Pin, which is used to represent the pinning feature in the user interface.
  • The useConversations hook in the use-conversation.tsx file is modified to include a new optional parameter, orderBy, which allows for ordering conversations by the is_pinned field.
  • A new hook, useToggleConversationPin, is added to the use-conversation.tsx file. This hook is used to toggle the pin status of a conversation.

@tianjing-li
Copy link
Collaborator

Thank you @danylo-boiko ! Will take a look this week

@danylo-boiko
Copy link
Contributor Author

Thank you @danylo-boiko ! Will take a look this week

@tianjing-li, how are things going with the code review?

Copy link
Collaborator

@tianjing-li tianjing-li left a comment

Choose a reason for hiding this comment

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

Looks great!

@tianjing-li tianjing-li added this pull request to the merge queue Sep 24, 2024
Merged via the queue into cohere-ai:main with commit 5af71bb Sep 24, 2024
7 checks passed
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