UNPKG

@lobehub/chat

Version:

Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.

35 lines (26 loc) 1.21 kB
import { messageMapKey } from '@/store/chat/utils/messageMapKey'; import type { ChatStoreState } from '../../initialState'; const isMessageInReasoning = (id: string) => (s: ChatStoreState) => s.reasoningLoadingIds.includes(id); const isMessageInSearchWorkflow = (id: string) => (s: ChatStoreState) => s.searchWorkflowLoadingIds.includes(id); const isIntentUnderstanding = (id: string) => (s: ChatStoreState) => isMessageInSearchWorkflow(id)(s); const isCurrentSendMessageLoading = (s: ChatStoreState) => { const operationKey = messageMapKey(s.activeId, s.activeTopicId); return s.mainSendMessageOperations[operationKey]?.isLoading || false; }; const isCurrentSendMessageError = (s: ChatStoreState) => { const operationKey = messageMapKey(s.activeId, s.activeTopicId); return s.mainSendMessageOperations[operationKey]?.inputSendErrorMsg; }; const isSendMessageLoadingForTopic = (topicKey: string) => (s: ChatStoreState) => s.mainSendMessageOperations[topicKey]?.isLoading ?? false; export const aiChatSelectors = { isCurrentSendMessageError, isCurrentSendMessageLoading, isIntentUnderstanding, isMessageInReasoning, isMessageInSearchWorkflow, isSendMessageLoadingForTopic, };