-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
💬 feat: Temporary Chats #5493
Open
ohneda
wants to merge
11
commits into
danny-avila:main
Choose a base branch
from
ohneda:feat/temporary-chat
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
💬 feat: Temporary Chats #5493
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Added `expiredAt` property to both Conversation and Message schemas. Configured `expireAfterSeconds` index in MongoDB to automatically delete documents after a specified period.
…ort temporary chats Added `isTemporary` property to TPayload and TSubmission for API calls for temporary chat. Additionally, added `expiredAt` property to `tConversationSchema` to determine if a chat is temporary.
Add Recoil state for tracking temporary conversations, update event handlers to respect temporary chat status
- Added a Temporary Chat switch button at the end of dropdown lists in each model. - Updated the form background color to black when Temporary Chat is enabled. - Modified Navigation to exclude Temporary Chats from the chat list.
Updated the getConvosQueried query to ensure that Temporary Chats are not included in the search results.
Updated the UI to ensure that the bookmark button is not displayed when a chat is as Temporary Chat.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a "Temporary Chat" feature with the following characteristics:
This feature basically follows ChatGPT's TemporaryChat specification.
Implementation Details
Added an
expiredAt
property to both theConversation
andMessage
models.Created a
expireAfterSeconds
index to leverage MongoDB's TTL (Time-To-Live) feature, which automatically deletes records after the specified time.expiredAt
isnull
or not defined, the chat is considered non-temporary.Note: Currently, both
Conversation
andMessage
are set to expire 30 days after creation. This means that someMessage
records may temporarily become "orphaned" if their parentConversation
is deleted first. While setting the sameexpiredAt
value for both models would ensure simultaneous deletion, this implementation prioritizes simplicity.Added a
temporaryChat
property to thelibrechat.yaml
configuration file under theinterface
section.false
, the Temporary Chat toggle will not be displayed in the UI.true
.The
transactions
model does not include theexpiredAt
property due to its specific role and behavior.transactions
model is not deleted when its parentConversation
is removed (based on the current implementation), this decision is expected to have no adverse effects. However, if any issues arise, I will revisit and adjust the implementation to ensure data consistency.Alternative Implementation Approaches
Other solutions, such as using Agenda.js or node-cron, were considered for more granular control over deletion logic. However, the current implementation using MongoDB's TTL feature was chosen for its simplicity.
Feedback and suggestions are welcome!
Change Type
Testing
The following scenarios were manually verified:
expiredAt
property is correctly set for bothConversation
andMessage
.expiredAt
property is not set.Conversation
andMessage
records withexpiredAt
are deleted after 30 days.librechat.yaml
'sinterface.temporaryChat
is set tofalse
, the Temporary Chat toggle is not displayed in the UI.Checklist