mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-19 09:50:15 +01:00
add RQ tokenizer
This commit is contained in:
parent
48e33fe1e9
commit
83df28f45d
4 changed files with 34 additions and 14 deletions
|
|
@ -18,6 +18,7 @@ export enum QueryKeys {
|
|||
endpoints = "endpoints",
|
||||
presets = "presets",
|
||||
searchResults = "searchResults",
|
||||
tokenCount = "tokenCount",
|
||||
}
|
||||
|
||||
export const useGetUserQuery = (): QueryObserverResult<t.TUser> => {
|
||||
|
|
@ -199,7 +200,6 @@ export const useSearchQuery = (
|
|||
pageNumber: string,
|
||||
config?: UseQueryOptions<t.TSearchResults>
|
||||
): QueryObserverResult<t.TSearchResults> => {
|
||||
console.log('useSearchFetcher', searchQuery, pageNumber)
|
||||
return useQuery<t.TSearchResults>([QueryKeys.searchResults, pageNumber, searchQuery], () =>
|
||||
dataService.searchConversations(searchQuery, pageNumber), {
|
||||
refetchOnWindowFocus: false,
|
||||
|
|
@ -208,4 +208,17 @@ export const useSearchQuery = (
|
|||
...config
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export const useUpdateTokenCountMutation = (): UseMutationResult<t.TUpdateTokenCountResponse, unknown, string, unknown> => {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation(
|
||||
(text: string) =>
|
||||
dataService.updateTokenCount(text),
|
||||
{
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries([QueryKeys.tokenCount]);
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue