feat: pull up the cost hooks into chatView to reduce api calls

This commit is contained in:
Dustin Healy 2025-08-21 02:15:33 -07:00
parent 3b1c07ff46
commit a820d79bfc
8 changed files with 57 additions and 32 deletions

View file

@ -51,9 +51,12 @@ function ChatView({ index = 0 }: { index?: number }) {
enabled: !!fileMap,
});
const { data: conversationCosts } = useGetConversationCosts(conversationId ?? '', {
enabled: !!conversationId && conversationId !== Constants.NEW_CONVO,
});
const { data: conversationCosts } = useGetConversationCosts(
conversationId && conversationId !== Constants.NEW_CONVO ? conversationId : '',
{
enabled: !!conversationId && conversationId !== Constants.NEW_CONVO && conversationId !== '',
},
);
const chatHelpers = useChatHelpers(index, conversationId);
const addedChatHelpers = useAddedResponse({ rootIndex: index });
@ -168,6 +171,7 @@ function ChatView({ index = 0 }: { index?: number }) {
</div>
)
}
costs={conversationCosts}
/>
);
} else {