🔍 refactor: Search & Message Retrieval (#6903)

* refactor: conversation search fetch

* refactor: Message and Convo fetch with paramters and search

* refactor: update search states and cleanup old store states

* refactor: re-enable search API; fix: search conversation

* fix: message's convo fetch

* fix: redirect when searching

* chore: use logger instead of console

* fix: search message loading

* feat: small optimizations

* feat(Message): remove cache for search path

* fix: handle delete of all archivedConversation and sharedLinks

* chore: cleanup

* fix: search messages

* style: update ConvoOptions styles

* refactor(SearchButtons): streamline conversation fetching and remove unused state

* fix: ensure messages are invalidated after fetching conversation data

* fix: add iconURL to conversation query selection

---------

Co-authored-by: Danny Avila <danny@librechat.ai>
This commit is contained in:
Marco Beretta 2025-04-17 03:07:43 +02:00 committed by GitHub
parent 851938e7a6
commit 88f4ad7c47
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 489 additions and 576 deletions

View file

@ -1,4 +1,5 @@
import type { AssistantsEndpoint } from './schemas';
import * as q from './types/queries';
// Testing this buildQuery function
const buildQuery = (params: Record<string, unknown>): string => {
@ -28,8 +29,19 @@ export const userPlugins = () => '/api/user/plugins';
export const deleteUser = () => '/api/user/delete';
export const messages = (conversationId: string, messageId?: string) =>
`/api/messages/${conversationId}${messageId != null && messageId ? `/${messageId}` : ''}`;
export const messages = (params: q.MessagesListParams) => {
const { conversationId, messageId, ...rest } = params;
if (conversationId && messageId) {
return `/api/messages/${conversationId}/${messageId}`;
}
if (conversationId) {
return `/api/messages/${conversationId}`;
}
return `/api/messages${buildQuery(rest)}`;
};
const shareRoot = '/api/share';
export const shareMessages = (shareId: string) => `${shareRoot}/${shareId}`;
@ -62,22 +74,7 @@ export const abortRequest = (endpoint: string) => `/api/ask/${endpoint}/abort`;
export const conversationsRoot = '/api/convos';
export const conversations = (
isArchived?: boolean,
sortBy?: 'title' | 'createdAt' | 'updatedAt',
sortDirection?: 'asc' | 'desc',
tags?: string[],
search?: string,
cursor?: string,
) => {
const params = {
isArchived,
sortBy,
sortDirection,
tags,
search,
cursor,
};
export const conversations = (params: q.ConversationListParams) => {
return `${conversationsRoot}${buildQuery(params)}`;
};