mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-22 19:30:15 +01:00
refactor and optimize search, add RQ for search
This commit is contained in:
parent
3d0bfaef51
commit
61cb2858bb
13 changed files with 71 additions and 102 deletions
|
|
@ -49,35 +49,14 @@ export function getSearchEnabled(): Promise<boolean> {
|
|||
return request.get(endpoints.searchEnabled());
|
||||
}
|
||||
|
||||
export function getSearchResults(q: string, pageNumber: string): Promise<t.TSearchResults> {
|
||||
return request.get(endpoints.search(q, pageNumber));
|
||||
}
|
||||
|
||||
export function getUser(): Promise<t.TUser> {
|
||||
return request.get(endpoints.user());
|
||||
}
|
||||
|
||||
type TSearchFetcherProps = {
|
||||
pre: () => void,
|
||||
q: string,
|
||||
pageNumber: string,
|
||||
callback: (data: any) => void
|
||||
};
|
||||
|
||||
export const searchConversations = async({ q, pageNumber, callback }: TSearchFetcherProps) => {
|
||||
return request.get(endpoints.search(q, pageNumber)).then(({ data }) => {
|
||||
callback(data);
|
||||
});
|
||||
export const searchConversations = async(q: string, pageNumber: string): Promise<t.TSearchResults> => {
|
||||
return request.get(endpoints.search(q, pageNumber));
|
||||
}
|
||||
|
||||
export const searchFetcher = async ({ pre, q, pageNumber, callback }: TSearchFetcherProps) => {
|
||||
pre();
|
||||
//@ts-ignore
|
||||
const { data } = await request.get(endpoints.search(q, pageNumber));
|
||||
console.log('search data', data);
|
||||
callback(data);
|
||||
};
|
||||
|
||||
export const getAIEndpoints = () => {
|
||||
return request.get(endpoints.aiEndpoints());
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue