mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-27 05:38:51 +01:00
Refactor: replace endpointsConfig recoil store with react query (#1085)
This commit is contained in:
parent
7d6a1d260f
commit
4073b7d05d
15 changed files with 83 additions and 49 deletions
|
|
@ -101,7 +101,7 @@ export const searchConversations = async (
|
|||
return request.get(endpoints.search(q, pageNumber));
|
||||
};
|
||||
|
||||
export const getAIEndpoints = () => {
|
||||
export const getAIEndpoints = (): Promise<t.TEndpointsConfig> => {
|
||||
return request.get(endpoints.aiEndpoints());
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -230,12 +230,19 @@ export const useGetSearchEnabledQuery = (
|
|||
});
|
||||
};
|
||||
|
||||
export const useGetEndpointsQuery = (): QueryObserverResult<t.TEndpointsConfig> => {
|
||||
return useQuery([QueryKeys.endpoints], () => dataService.getAIEndpoints(), {
|
||||
refetchOnWindowFocus: false,
|
||||
refetchOnReconnect: false,
|
||||
refetchOnMount: false,
|
||||
});
|
||||
export const useGetEndpointsQuery = <TData = t.TEndpointsConfig>(
|
||||
config?: UseQueryOptions<t.TEndpointsConfig, unknown, TData>,
|
||||
): QueryObserverResult<TData> => {
|
||||
return useQuery<t.TEndpointsConfig, unknown, TData>(
|
||||
[QueryKeys.endpoints],
|
||||
() => dataService.getAIEndpoints(),
|
||||
{
|
||||
refetchOnWindowFocus: false,
|
||||
refetchOnReconnect: false,
|
||||
refetchOnMount: false,
|
||||
...config,
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
export const useGetModelsQuery = (
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ export type TConfig = {
|
|||
availableModels?: [];
|
||||
userProvide?: boolean | null;
|
||||
availableTools?: [];
|
||||
plugins?: [];
|
||||
plugins?: Record<string, string>;
|
||||
azure?: boolean;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue