UNPKG

@plteam/chat-ui

Version:

CUI Kit is a free and open-source library for creating AI assistant chat interfaces, built with React, Material UI, and TypeScript

17 lines (16 loc) 632 B
import * as React from 'react'; import { arrayLast } from '../../utils/arrayUtils/arrayLast'; export const useMessageProgressStatus = (thread) => { return React.useCallback((status, inProgress) => { if (thread) { thread.streamStatus.value = status; if (inProgress !== undefined) { const lastMessage = arrayLast(thread.messages.currentMessages.value); if (lastMessage) { lastMessage.typing.value = inProgress; thread.isTyping.value = inProgress; } } } }, [thread]); };