mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-23 10:46:12 +01:00
refactor: swap conversationCosts query hooks out for new modelCosts query and move to react-query-service
This commit is contained in:
parent
4fb9d7bdff
commit
95ebef13df
2 changed files with 17 additions and 33 deletions
|
|
@ -77,6 +77,23 @@ export const useGetConversationByIdQuery = (
|
|||
);
|
||||
};
|
||||
|
||||
export const useGetModelCostsQuery = (
|
||||
modelHistory: Array<{ model: string; endpoint: string }>,
|
||||
config?: UseQueryOptions<t.TModelCosts>,
|
||||
): QueryObserverResult<t.TModelCosts> => {
|
||||
return useQuery<t.TModelCosts>(
|
||||
[QueryKeys.modelCosts, modelHistory],
|
||||
() => dataService.getModelCosts(modelHistory),
|
||||
{
|
||||
refetchOnWindowFocus: false,
|
||||
refetchOnReconnect: false,
|
||||
refetchOnMount: false,
|
||||
enabled: !!modelHistory && modelHistory.length > 0,
|
||||
...config,
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
//This isn't ideal because its just a query and we're using mutation, but it was the only way
|
||||
//to make it work with how the Chat component is structured
|
||||
export const useGetConversationByIdMutation = (id: string): UseMutationResult<s.TConversation> => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue