Skip to content

Commit

Permalink
refactor: move isMessageAIGenerated to global scope in vite App
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinCupela committed Feb 4, 2025
1 parent 30746c0 commit fc2a860
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions examples/vite/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,16 @@ type StreamChatGenerics = {
userType: LocalUserType;
};

const isMessageAIGenerated = (message: StreamMessage<StreamChatGenerics>) =>
!!message?.ai_generated;

const App = () => {
const chatClient = useCreateChatClient<StreamChatGenerics>({
apiKey,
tokenOrProvider: userToken,
userData: { id: userId },
});

const isMessageAIGenerated = useCallback(
(message: StreamMessage<StreamChatGenerics>) => !!message?.ai_generated,
[],
);

if (!chatClient) return <>Loading...</>;

return (
Expand Down

0 comments on commit fc2a860

Please sign in to comment.