mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-04-07 00:15:23 +02:00
feat: extend data retention to files, tool calls, and shared links
Add expiredAt field and TTL indexes to file, toolCall, and share schemas. Set expiredAt on tool calls, shared links, and file uploads when retentionMode is "all" or chat is temporary. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
30109e90b0
commit
48973752d3
13 changed files with 101 additions and 17 deletions
|
|
@ -345,6 +345,7 @@ export function createShareMethods(mongoose: typeof import('mongoose')) {
|
|||
user: string,
|
||||
conversationId: string,
|
||||
targetMessageId?: string,
|
||||
expiredAt?: Date,
|
||||
): Promise<t.CreateShareResult> {
|
||||
if (!user || !conversationId) {
|
||||
throw new ShareServiceError('Missing required parameters', 'INVALID_PARAMS');
|
||||
|
|
@ -408,6 +409,7 @@ export function createShareMethods(mongoose: typeof import('mongoose')) {
|
|||
title,
|
||||
user,
|
||||
...(targetMessageId && { targetMessageId }),
|
||||
...(expiredAt && { expiredAt }),
|
||||
});
|
||||
|
||||
return { shareId, conversationId };
|
||||
|
|
@ -460,7 +462,11 @@ export function createShareMethods(mongoose: typeof import('mongoose')) {
|
|||
/**
|
||||
* Update a shared link with new messages
|
||||
*/
|
||||
async function updateSharedLink(user: string, shareId: string): Promise<t.UpdateShareResult> {
|
||||
async function updateSharedLink(
|
||||
user: string,
|
||||
shareId: string,
|
||||
expiredAt?: Date,
|
||||
): Promise<t.UpdateShareResult> {
|
||||
if (!user || !shareId) {
|
||||
throw new ShareServiceError('Missing required parameters', 'INVALID_PARAMS');
|
||||
}
|
||||
|
|
@ -485,6 +491,7 @@ export function createShareMethods(mongoose: typeof import('mongoose')) {
|
|||
messages: updatedMessages,
|
||||
user,
|
||||
shareId: newShareId,
|
||||
...(expiredAt && { expiredAt }),
|
||||
};
|
||||
|
||||
const updatedShare = (await SharedLink.findOneAndUpdate({ shareId, user }, update, {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue