refactor: swap conversationCosts query hooks out for new modelCosts query and move to react-query-service

This commit is contained in:
Dustin Healy 2025-09-13 12:42:43 -07:00
parent 4fb9d7bdff
commit 95ebef13df
2 changed files with 17 additions and 33 deletions

View file

@ -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> => {